Click here to Skip to main content
15,885,216 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to clean contents of a file Pin
PankajB22-Mar-09 23:33
PankajB22-Mar-09 23:33 
AnswerRe: How to clean contents of a file Pin
_AnsHUMAN_ 22-Mar-09 23:37
_AnsHUMAN_ 22-Mar-09 23:37 
GeneralRe: How to clean contents of a file Pin
PankajB22-Mar-09 23:40
PankajB22-Mar-09 23:40 
GeneralRe: How to clean contents of a file Pin
Cedric Moonen22-Mar-09 23:44
Cedric Moonen22-Mar-09 23:44 
GeneralRe: How to clean contents of a file Pin
«_Superman_»22-Mar-09 23:44
professional«_Superman_»22-Mar-09 23:44 
GeneralRe: How to clean contents of a file Pin
PankajB22-Mar-09 23:49
PankajB22-Mar-09 23:49 
GeneralRe: How to clean contents of a file Pin
«_Superman_»23-Mar-09 0:02
professional«_Superman_»23-Mar-09 0:02 
AnswerRe: How to clean contents of a file Pin
Eytukan23-Mar-09 0:34
Eytukan23-Mar-09 0:34 
PankajB wrote:
Now, my requirement is, each and every time I write a name into the file, i want to delete the previous name.


Little weird. So what do achieve by writing them into the file immediately? If you want to keep the last-entered text to be written, you can keep them in a temp buffer and write it into the file at the end. Otherwise if you want to keep up the requirement, I'd suggest the same as everybody there, something like

ofstream ofs;

while(your_input_loop)
{
 ofs.open("txt",ios::out);
 //Get input// write//
 ofs.close();
}


As you show in your code, the control already waits for user inputs. So it doesn't make sense to count performance there.

He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus

QuestionRe: How to clean contents of a file Pin
David Crow23-Mar-09 3:29
David Crow23-Mar-09 3:29 
QuestionCan we create a Toolbar without MenuBar? Pin
Abhijit D. Babar22-Mar-09 22:46
Abhijit D. Babar22-Mar-09 22:46 
AnswerRe: Can we create a Toolbar without MenuBar? Pin
Iain Clarke, Warrior Programmer22-Mar-09 23:32
Iain Clarke, Warrior Programmer22-Mar-09 23:32 
GeneralRe: Can we create a Toolbar without MenuBar? Pin
Abhijit D. Babar23-Mar-09 0:19
Abhijit D. Babar23-Mar-09 0:19 
GeneralRe: Can we create a Toolbar without MenuBar? Pin
Iain Clarke, Warrior Programmer23-Mar-09 0:28
Iain Clarke, Warrior Programmer23-Mar-09 0:28 
Questionfloating point exceptions instead of INF, NaN Pin
sor73naf22-Mar-09 22:42
sor73naf22-Mar-09 22:42 
AnswerRe: floating point exceptions instead of INF, NaN Pin
Dominik Reichl22-Mar-09 23:59
Dominik Reichl22-Mar-09 23:59 
GeneralRe: floating point exceptions instead of INF, NaN Pin
sor73naf23-Mar-09 3:03
sor73naf23-Mar-09 3:03 
QuestionWinInet - INTERNET_CACHE_ENTRY_INFO - Header Info [modified] Pin
CString(0xcccccccc)22-Mar-09 22:33
CString(0xcccccccc)22-Mar-09 22:33 
QuestionWhat is the SEH in release build VS2008 with fclose()? Pin
Chesnokov Yuriy22-Mar-09 22:32
professionalChesnokov Yuriy22-Mar-09 22:32 
AnswerRe: What is the SEH in release build VS2008 with fclose()? Pin
Eytukan23-Mar-09 0:26
Eytukan23-Mar-09 0:26 
QuestionRe: What is the SEH in release build VS2008 with fclose()? Pin
Chesnokov Yuriy23-Mar-09 2:10
professionalChesnokov Yuriy23-Mar-09 2:10 
AnswerRe: What is the SEH in release build VS2008 with fclose()? Pin
Eytukan23-Mar-09 2:47
Eytukan23-Mar-09 2:47 
QuestionDMA access from user-mode Pin
Maxwell Chen22-Mar-09 21:58
Maxwell Chen22-Mar-09 21:58 
AnswerRe: DMA access from user-mode Pin
Iain Clarke, Warrior Programmer22-Mar-09 23:35
Iain Clarke, Warrior Programmer22-Mar-09 23:35 
GeneralRe: DMA access from user-mode Pin
Maxwell Chen23-Mar-09 3:58
Maxwell Chen23-Mar-09 3:58 
AnswerRe: DMA access from user-mode Pin
Eytukan23-Mar-09 0:41
Eytukan23-Mar-09 0:41 

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.