Click here to Skip to main content
15,887,361 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionCrystal Reports 11 with visual Studio .NET Pin
Irfan Shahid23-Feb-06 1:07
Irfan Shahid23-Feb-06 1:07 
QuestionPls Help Pin
trinadh_t23-Feb-06 0:48
trinadh_t23-Feb-06 0:48 
AnswerRe: Pls Help Pin
murali_utr23-Feb-06 0:52
murali_utr23-Feb-06 0:52 
GeneralRe: Pls Help Pin
trinadh_t23-Feb-06 1:10
trinadh_t23-Feb-06 1:10 
GeneralRe: Pls Help Pin
murali_utr23-Feb-06 1:30
murali_utr23-Feb-06 1:30 
GeneralRe: Pls Help Pin
Dennis Gourjii23-Feb-06 1:33
Dennis Gourjii23-Feb-06 1:33 
JokeRe: Pls Help Pin
jhwurmbach23-Feb-06 22:13
jhwurmbach23-Feb-06 22:13 
QuestionBest way to Write and read from a file Pin
fearless stallion23-Feb-06 0:48
fearless stallion23-Feb-06 0:48 
I am using win32 APIs for this project. I have to write records into a file and for that i was using FILE * fp; fwrite() and fread(). the Structure i am writing into file contains char fn[100];char sn[1000];char dt[20];char tm[20]; int ET;. Now for few reasons i had to change the sturcture and change the "dt" and "tm" fields to two different structures.each having three Integer variables.Now When i am trying to write records into the file it is working fine but when i am trying read from the file it just dies at the new "tm" sturcture's first int variable. While debugging i found that the other two variables contain some illegal values. the statement while(fread(&data,sizeof(data),1,fp)==1) breaks and goes to the next line of loop which is fclose(fp); before changing to new structure it was working fine(both read and write).

Why is it so? and is fread and fwrite are not safe ways to write records into a file ? if so, then, is there any better solutions for this? can anybody suggest the best Riskfree and Errorfree way to write and read from a file? cause i have to read and write to this file 10 times a minute(approx). Sniff | :^)

Thanks in advance

kss
AnswerRe: Best way to Write and read from a file Pin
James R. Twine23-Feb-06 0:57
James R. Twine23-Feb-06 0:57 
GeneralRe: Best way to Write and read from a file Pin
fearless stallion23-Feb-06 1:58
fearless stallion23-Feb-06 1:58 
AnswerRe: Best way to Write and read from a file Pin
James R. Twine23-Feb-06 2:30
James R. Twine23-Feb-06 2:30 
AnswerRe: Best way to Write and read from a file Pin
Dennis Gourjii23-Feb-06 1:36
Dennis Gourjii23-Feb-06 1:36 
QuestionRe: Best way to Write and read from a file Pin
fearless stallion23-Feb-06 1:53
fearless stallion23-Feb-06 1:53 
AnswerRe: Best way to Write and read from a file Pin
Dennis Gourjii23-Feb-06 2:56
Dennis Gourjii23-Feb-06 2:56 
JokeRe: Best way to Write and read from a file Pin
James R. Twine23-Feb-06 2:33
James R. Twine23-Feb-06 2:33 
GeneralRe: Best way to Write and read from a file Pin
Dennis Gourjii23-Feb-06 2:50
Dennis Gourjii23-Feb-06 2:50 
JokeRe: Best way to Write and read from a file Pin
James R. Twine23-Feb-06 3:28
James R. Twine23-Feb-06 3:28 
GeneralRe: Best way to Write and read from a file Pin
Dennis Gourjii23-Feb-06 3:45
Dennis Gourjii23-Feb-06 3:45 
AnswerRe: Best way to Write and read from a file Pin
James R. Twine23-Feb-06 4:51
James R. Twine23-Feb-06 4:51 
AnswerRe: Best way to Write and read from a file Pin
Wim Engberts23-Feb-06 5:01
Wim Engberts23-Feb-06 5:01 
GeneralRe: Best way to Write and read from a file Pin
fearless stallion23-Feb-06 19:03
fearless stallion23-Feb-06 19:03 
GeneralRe: Best way to Write and read from a file Pin
Wim Engberts23-Feb-06 23:17
Wim Engberts23-Feb-06 23:17 
GeneralRe: Best way to Write and read from a file Pin
fearless stallion24-Feb-06 1:17
fearless stallion24-Feb-06 1:17 
AnswerRe: ListCtrl Pin
James R. Twine23-Feb-06 4:55
James R. Twine23-Feb-06 4:55 
QuestionOverwriting in the console Pin
Cedric Moonen22-Feb-06 23:59
Cedric Moonen22-Feb-06 23:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.