Click here to Skip to main content
15,912,578 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Printing a txt file Pin
dxlee29-Oct-09 3:59
dxlee29-Oct-09 3:59 
GeneralRe: Printing a txt file Pin
Benjamin Bruno29-Oct-09 18:29
Benjamin Bruno29-Oct-09 18:29 
GeneralRe: Printing a txt file Pin
dxlee30-Oct-09 4:57
dxlee30-Oct-09 4:57 
AnswerRe: Printing a txt file Pin
David Crow29-Oct-09 2:51
David Crow29-Oct-09 2:51 
GeneralRe: Printing a txt file Pin
Benjamin Bruno29-Oct-09 19:18
Benjamin Bruno29-Oct-09 19:18 
QuestionSpecial Significance of CSingleLock and CMultiLock ????? Pin
Hari_1628-Oct-09 19:16
Hari_1628-Oct-09 19:16 
Questionwrite problem in ios::in|ios::out|ios::app mode Pin
xbottle28-Oct-09 18:05
xbottle28-Oct-09 18:05 
AnswerRe: write problem in ios::in|ios::out|ios::app mode [modified] Pin
Randor 28-Oct-09 19:09
professional Randor 28-Oct-09 19:09 
Hi.

Some comments:

1.) I see an infinite while loop without any conditional breakage. Why do you need this?
2.) You are calling strlen on a char array without a NULL terminator. You should probably use strcpy instead of memcpy.


xbottle wrote:
but the second "f<<s<<std::endl" can="" not="" write="" database="" to="" the="" 1.txt="" file.<="" blockquote="">

Your second while loop will never be true on the second pass because you are at the end of the file after you write to the file. However if you fix this it will cause an infinite loop. I would suggest that you redesign your logic flow.

Update your code and come back for a second analysis.

Best Wishes,
-David Delaune

modified on Thursday, October 29, 2009 1:16 AM

GeneralRe: write problem in ios::in|ios::out|ios::app mode Pin
xbottle28-Oct-09 20:20
xbottle28-Oct-09 20:20 
GeneralRe: write problem in ios::in|ios::out|ios::app mode Pin
Randor 28-Oct-09 21:48
professional Randor 28-Oct-09 21:48 
GeneralRe: write problem in ios::in|ios::out|ios::app mode Pin
xbottle29-Oct-09 23:33
xbottle29-Oct-09 23:33 
GeneralRe: write problem in ios::in|ios::out|ios::app mode Pin
enhzflep28-Oct-09 21:53
enhzflep28-Oct-09 21:53 
AnswerRe: write problem in ios::in|ios::out|ios::app mode Pin
David Crow29-Oct-09 2:56
David Crow29-Oct-09 2:56 
QuestionRe: write problem in ios::in|ios::out|ios::app mode Pin
David Crow29-Oct-09 2:54
David Crow29-Oct-09 2:54 
Questionwhy optimization since program is trade-off between time and memory Pin
jianzhuhuai28-Oct-09 14:36
jianzhuhuai28-Oct-09 14:36 
AnswerRe: why optimization since program is trade-off between time and memory Pin
Rozis29-Oct-09 12:07
Rozis29-Oct-09 12:07 
GeneralRe: why optimization since program is trade-off between time and memory Pin
jianzhuhuai31-Oct-09 5:35
jianzhuhuai31-Oct-09 5:35 
Questionwhy add member function in classview does not work for overloaded function operator &lt;() Pin
jianzhuhuai28-Oct-09 14:15
jianzhuhuai28-Oct-09 14:15 
AnswerRe: why add member function in classview does not work for overloaded function operator &lt;() Pin
«_Superman_»28-Oct-09 14:37
professional«_Superman_»28-Oct-09 14:37 
AnswerRe: why add member function in classview does not work for overloaded function operator &lt;() Pin
Adam Roderick J28-Oct-09 18:30
Adam Roderick J28-Oct-09 18:30 
Questionconvert CString to const char * Pin
Manmohan2928-Oct-09 7:23
Manmohan2928-Oct-09 7:23 
AnswerRe: convert CString to const char * Pin
David Crow28-Oct-09 7:37
David Crow28-Oct-09 7:37 
AnswerRe: convert CString to const char * Pin
transoft28-Oct-09 7:39
transoft28-Oct-09 7:39 
AnswerRe: convert CString to const char * Pin
«_Superman_»28-Oct-09 7:56
professional«_Superman_»28-Oct-09 7:56 
AnswerRe: convert CString to const char * Pin
Kushagra Tiwari28-Oct-09 21:31
Kushagra Tiwari28-Oct-09 21:31 

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.