Hi everyone;
i am making a program to get familiar with writing and reading files,this program is to write the time that lets say an employee comes to work and what time she checks out ,and only executes twice a day.
i have a problem with my code ,
i want to create a file and to write to it sequentially.
the info to write is the date format and local time,that it will write to file every time we execute the program in WM_CREATE msg.
///////
//////
static int ,i, j, k, l;
static char a[50], s[50],
file *pfile
//////
//////
to get
GetlocalTime(///////////////////////,, ////////////)
GetDate//Format(//////////////////&st, a, ////////)
Here i stored the value for date format which is like:
"tuesday, january, 14 2003" in array a and start writing the info in file name time.dat:
fopen = ,,,,,(pfile , "time.dat"//////);
fprintf(pfile, "%s%d%d%d\n", a, st.wHour, st.wMinute, st.wSecond);
fclose(pfile);
up to here i check the file and the program writes to it Ok.
then in WM_PAINT i process reding the same file and go about it by:
fscanf(pfile, "%s%d%d%d", s, j, k, l);
sprintf(f, "%d%d%d", j, k, l);
here is the problem when i try reading the values with text out
TextOut(//////////////,,,,,,s,,,,,)
TextOut(///////////////,,,,f,,,,,,,)
what it shows on screen is like;
thursday 11.48.20
and leaves out the rest of the date format ,but if i use 4 arrays in fscanf instead of one like this:
fscanf(pfile, "%s%s%s%s%d%d%d", s, s1, s2, s3, j, k, l);
it shows the whole string. WHY? is it because it reads the space characters as null how do i skip them?www.cprogramming.com http\\www.cprog.com i have a problem iiiiiiiiiiiii [IMG]http://[/IMG] i want to