Click here to Skip to main content
15,845,212 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Printing a txt file Pin
dxlee30-Oct-09 5:57
dxlee30-Oct-09 5:57 
AnswerRe: Printing a txt file Pin
David Crow29-Oct-09 3:51
David Crow29-Oct-09 3:51 
GeneralRe: Printing a txt file Pin
Benjamin Bruno29-Oct-09 20:18
Benjamin Bruno29-Oct-09 20:18 
QuestionSpecial Significance of CSingleLock and CMultiLock ????? Pin
Hari_1628-Oct-09 20:16
Hari_1628-Oct-09 20:16 
Questionwrite problem in ios::in|ios::out|ios::app mode Pin
xbottle28-Oct-09 19:05
xbottle28-Oct-09 19:05 
AnswerRe: write problem in ios::in|ios::out|ios::app mode [modified] Pin
Randor 28-Oct-09 20:09
professional Randor 28-Oct-09 20:09 
GeneralRe: write problem in ios::in|ios::out|ios::app mode Pin
xbottle28-Oct-09 21:20
xbottle28-Oct-09 21:20 
GeneralRe: write problem in ios::in|ios::out|ios::app mode Pin
Randor 28-Oct-09 22:48
professional Randor 28-Oct-09 22:48 
xbottle wrote:
1.)This is a part of my code.In my code ,it’s a thread code.So I use an infinite while loop.


Ok, but how do you plan to end the thread?

xbottle wrote:
2.)you let me use strcpy instead of memcpy ,I have used strcpy instead of memcpy.But I think it’s not the reason that I can’t write the file.


It could cause the application to crash. Always NULL terminate your char arrays before calling CRT functions such as strlen.

xbottle wrote:
3.) My second while loop is really true on the second pass.
I’m not sure the reason. Before my second while loop, “f.seekg(0, ios::beg)”seek the begin of the file,maybe that’s why I’m not at the end of the file after I write to the file.


Ok, I understand you now. The EOF bit has probably been set. Add this at the bottom of your second while loop:

if(f.eof())
	f.clear();


Best Wishes,
-David Delaune
GeneralRe: write problem in ios::in|ios::out|ios::app mode Pin
xbottle30-Oct-09 0:33
xbottle30-Oct-09 0:33 
GeneralRe: write problem in ios::in|ios::out|ios::app mode Pin
enhzflep28-Oct-09 22:53
enhzflep28-Oct-09 22:53 
AnswerRe: write problem in ios::in|ios::out|ios::app mode Pin
David Crow29-Oct-09 3:56
David Crow29-Oct-09 3:56 
QuestionRe: write problem in ios::in|ios::out|ios::app mode Pin
David Crow29-Oct-09 3:54
David Crow29-Oct-09 3:54 
Questionwhy optimization since program is trade-off between time and memory Pin
jianzhuhuai28-Oct-09 15:36
jianzhuhuai28-Oct-09 15:36 
AnswerRe: why optimization since program is trade-off between time and memory Pin
Rozis29-Oct-09 13:07
Rozis29-Oct-09 13:07 
GeneralRe: why optimization since program is trade-off between time and memory Pin
jianzhuhuai31-Oct-09 6:35
jianzhuhuai31-Oct-09 6:35 
Questionwhy add member function in classview does not work for overloaded function operator <() Pin
jianzhuhuai28-Oct-09 15:15
jianzhuhuai28-Oct-09 15:15 
AnswerRe: why add member function in classview does not work for overloaded function operator <() Pin
«_Superman_»28-Oct-09 15:37
professional«_Superman_»28-Oct-09 15:37 
AnswerRe: why add member function in classview does not work for overloaded function operator <() Pin
Adam Roderick J28-Oct-09 19:30
Adam Roderick J28-Oct-09 19:30 
Questionconvert CString to const char * Pin
Manmohan2928-Oct-09 8:23
Manmohan2928-Oct-09 8:23 
AnswerRe: convert CString to const char * Pin
David Crow28-Oct-09 8:37
David Crow28-Oct-09 8:37 
AnswerRe: convert CString to const char * Pin
transoft28-Oct-09 8:39
transoft28-Oct-09 8:39 
AnswerRe: convert CString to const char * Pin
«_Superman_»28-Oct-09 8:56
professional«_Superman_»28-Oct-09 8:56 
AnswerRe: convert CString to const char * Pin
Kushagra Tiwari28-Oct-09 22:31
Kushagra Tiwari28-Oct-09 22:31 
QuestionOpenCV application error Pin
dSolariuM28-Oct-09 6:28
dSolariuM28-Oct-09 6:28 
QuestionRe: OpenCV application error Pin
David Crow28-Oct-09 6:34
David Crow28-Oct-09 6:34 

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.