ALERT!
Click here to register with a few steps and explore all our cool stuff we have to offer!
Home
Upgrade
Credits
Help
Search
Awards
Achievements
 2365

Simple Logging to a File from your menu

by quadrant2005 - 04-13-2020 - 12:03 PM
#1
hi there this is my first ever time posting here, so ive a lot to learn. I wanted to share some code for logging. This is code that ive used in the past to log from some of my Pc applications that
ive written over the years and Quake2 mods that i worked on. I added it to my XBOX360 menu it builds fine but for some reason i do not get any file written to the drive. Im new to Xbox360
Dev. But wanted to share my code anyone incase it would be helpful to someone. cheers regards Richard quadrant2005
Code:
#include <time.h>

static const char * f_szLogFile = "HDD:\\quadkill.log";

void Log_Printf(const char * format,...)
{
time_t now;
char timestring[64];
va_list marker;
FILE * fp = 0;

va_start(marker, format);
fp = fopen(f_szLogFile , "a+");

if (!fp)
return;
time(&now);
fprintf(fp, timestring);
vfprintf(fp, format, marker);
fclose(fp);
}

owe i see you use the code thingy to imbedd the code into the forum post :) at least i got that bit right, 
Code:
; to use the above code here are examples of calling it 
Log_PrintQ ("Name %s : Max Armour %s\n",PLAYER::GET_PLAYER_NAME(i),PLAYER::GET_PLAYER_MAX_ARMOUR(i));
Log_PrintQ      ("hello this is a test\n");
Reply
#2
this is from united x source lol
Reply
#3
(04-14-2020 - 11:06 PM)Venom_Modz Wrote: this is from united x source lol
I originally wrote this code back in 1997 for use with my Quake2 Mods that i was coding.. If it was taken from another GTA V im sure i would have it working by now on the xbox360 im very new to the Xbox360 side of coding and just wanted to share some code that i wrote long ago for the pc that ive tried to adapt for the xbox360, But ive no idea of what path to use on the xbox360 any help would be apprecaited, I worked on many many quake2 mods over the years and also wrote a full 2d 3d gaming engine for the pc platform regards quadrant2005
Reply
#4
(04-15-2020 - 06:18 PM)quadrant2005 Wrote:
(04-14-2020 - 11:06 PM)Venom_Modz Wrote: this is from united x source lol
I originally wrote this code back in 1997 for use with my Quake2 Mods that i was coding.. If it was taken from another GTA V im sure i would have it working by now on the xbox360 im very new to the Xbox360 side of coding and just wanted to share some code that i wrote long ago for the pc that ive tried to adapt for the xbox360, But ive no idea of what path to use on the xbox360 any help would be apprecaited, I worked on many many quake2 mods over the years and also wrote a full 2d 3d gaming engine for the pc platform regards quadrant2005
Any help in getting this up and running on the xbox360 would be much appreciated, Ive tried several different paths with no luck, 
Code:
static const char * f_szLogFile = "HDD:\\quadkill.log";
//static const char * f_szLogFile = "\\Device\\Harddisk0\\Partition1\\quadkill.log";

void Log_Printf(const char * format,...)
{
time_t now;
char timestring[64];
va_list marker;
FILE * fp = 0;

va_start(marker, format);
fp = fopen(f_szLogFile , "a+");

if (!fp)
{
printf("Can not create file");
return;
}
time(&now);
fprintf(fp, timestring);
vfprintf(fp, format, marker);
fclose(fp);
}
//[QBS]e
Reply
#5
im still having no luck with writting to my log, if anyone could help that would be much appreciated, Ive tried lots of different paths but no luck, the code works fine on a pc. Ive used it on loads of projects over the years..
static const char * f_szLogFile = "/dev_hdd0/quadkill.log";
//static const char * f_szLogFile = "GAME:\\files\\quadkill.log";
//static const char * f_szLogFile = "HDD:\\quadkill.log";
//static const char * f_szLogFile = "\\Device\\Harddisk0\\Partition1\\quadkill.log";

tried all these methods no luck
Reply
#6
ooooooooooooooooooof
Reply
#7
but yet you wrote the code lol
Reply
#8
(04-15-2020 - 06:18 PM)quadrant2005 Wrote:
(04-14-2020 - 11:06 PM)Venom_Modz Wrote: this is from united x source lol
I originally wrote this code back in 1997 for use with my Quake2 Mods that i was coding.. If it was taken from another GTA V im sure i would have it working by now on the xbox360 im very new to the Xbox360 side of coding and just wanted to share some code that i wrote long ago for the pc that ive tried to adapt for the xbox360, But ive no idea of what path to use on the xbox360 any help would be apprecaited, I worked on many many quake2 mods over the years and also wrote a full 2d 3d gaming engine for the pc platform regards quadrant2005
Your a idiot.

360 was not even around in the 90s, and you didnt make this.

Also ur story dose not make any sence,
Reply
#9
lel for ps 3 tooo ?
Reply
#10
(04-27-2020 - 09:38 PM)magiccarpet Wrote:
(04-15-2020 - 06:18 PM)quadrant2005 Wrote:
(04-14-2020 - 11:06 PM)Venom_Modz Wrote: this is from united x source lol
I originally wrote this code back in 1997 for use with my Quake2 Mods that i was coding.. If it was taken from another GTA V im sure i would have it working by now on the xbox360 im very new to the Xbox360 side of coding and just wanted to share some code that i wrote long ago for the pc that ive tried to adapt for the xbox360, But ive no idea of what path to use on the xbox360 any help would be apprecaited, I worked on many many quake2 mods over the years and also wrote a full 2d 3d gaming engine for the pc platform regards quadrant2005
Your a idiot.

360 was not even around in the 90s, and you didnt make this.

Also ur story dose not make any sence,

"Why are people so nasty here when all ive done is ask for help, I did not say that the Xbox360 existed in the 90s im a computer programmer. I do not normally work with the Xbox i normally write code for the Pc, i either originally wrote the code back in 1997 or learned it from C booklets of the time. I worked on many Quake2 gamex86 mods for quake2 on the pc, Quadkill,Kots,Vortex, Rvr etc.. All i have done is post the code and ask for help on the correct pathing to get it to work on the xbox360, The reason i do not have it working is because i do not have the source code to the menu you mentioned. The code i posted also is not to read a file but to write to it.  You do not know me and you do not know anything about me.."

(04-27-2020 - 06:45 AM)Venom_Modz Wrote: but yet you wrote the code lol
The code was written for the PC long ago, the code works fine on the pc with no issues at all, For the xbox360 i know very little about them and there drive structure. All i did was ask for help and get faced here with criticisum... What a community you all having going here... you all must be so proud..
Reply

Users browsing: 9 Guest(s)