Click here to Skip to main content
16,005,682 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionCreateProcessWithLogonW limitations? Pin
fourierman28-May-06 6:24
fourierman28-May-06 6:24 
AnswerRe: CreateProcessWithLogonW limitations? Pin
fourierman28-May-06 10:08
fourierman28-May-06 10:08 
AnswerRe: CreateProcessWithLogonW limitations? Pin
bob1697228-May-06 11:20
bob1697228-May-06 11:20 
GeneralRe: CreateProcessWithLogonW limitations? Pin
fourierman28-May-06 11:49
fourierman28-May-06 11:49 
QuestionHow i write text in a file Pin
Immunity1828-May-06 5:59
Immunity1828-May-06 5:59 
AnswerRe: How i write text in a file [modified] Pin
bob1697228-May-06 6:30
bob1697228-May-06 6:30 
GeneralRe: How i write text in a file [modified] Pin
Immunity1828-May-06 6:49
Immunity1828-May-06 6:49 
GeneralRe: How i write text in a file [modified] Pin
bob1697228-May-06 7:07
bob1697228-May-06 7:07 
Your making it harder than it should be. (NOTE: the appending to existing file thing was an assumption so if your wanting to create the file new each time if it doesn't exist and overwrite the previous file if any, use the modified open flags below)

CString sFilePath="c:\\temp\\myfile.txt";
CStdioFile file;
CString sOutput="This is a long string to see how to append every 10 chars in the string to a file";
int nCount=sOutput.GetLength();

try {

if (file.Open(sFilePath,CFile::modeReadWrite|CFile::modeCreate)) {
file.SeekToEnd(); // Go to end of file.

for (int i=0;i<nCount;i+=10) {
file.WriteString(sOutput.Mid(i,10)+"\r\n"); // Append text
}
file.Close();
}
}

catch (CException * e) {

e->ReportError(); // Popup description of exception
e->Delete(); // Clean up.
}

catch (...) { // Catch any other exceptions
AfxMessageBox("Failed to open file!");
}

-- modified at 13:35 Sunday 28th May, 2006
GeneralRe: How i write text in a file [modified] Pin
bob1697228-May-06 7:16
bob1697228-May-06 7:16 
GeneralRe: How i write text in a file [modified] Pin
Immunity1828-May-06 7:18
Immunity1828-May-06 7:18 
QuestionSpeed up listview when adding thousands of items Pin
Master Gollom28-May-06 5:56
Master Gollom28-May-06 5:56 
AnswerRe: Speed up listview when adding thousands of items Pin
bob1697228-May-06 6:36
bob1697228-May-06 6:36 
GeneralRe: Speed up listview when adding thousands of items Pin
Master Gollom28-May-06 6:41
Master Gollom28-May-06 6:41 
GeneralRe: Speed up listview when adding thousands of items Pin
Immunity1828-May-06 9:32
Immunity1828-May-06 9:32 
AnswerRe: Speed up listview when adding thousands of items [modified] Pin
anwer_skk28-May-06 16:45
anwer_skk28-May-06 16:45 
GeneralRe: Speed up listview when adding thousands of items [modified] Pin
Master Gollom28-May-06 22:32
Master Gollom28-May-06 22:32 
QuestionDragListBox with additions Pin
Luksky28-May-06 4:30
Luksky28-May-06 4:30 
AnswerRe: DragListBox with additions Pin
Luksky28-May-06 11:57
Luksky28-May-06 11:57 
QuestionHow do i make another window w/o code Pin
Haun the 2nd28-May-06 2:51
Haun the 2nd28-May-06 2:51 
AnswerRe: How do i make another window w/o code Pin
bob1697228-May-06 7:33
bob1697228-May-06 7:33 
GeneralRe: How do i make another window w/o code Pin
ThatsAlok28-May-06 23:02
ThatsAlok28-May-06 23:02 
AnswerRe: How do i make another window w/o code Pin
Haun the 2nd29-May-06 5:59
Haun the 2nd29-May-06 5:59 
GeneralRe: How do i make another window w/o code Pin
ThatsAlok29-May-06 18:57
ThatsAlok29-May-06 18:57 
QuestionDouble buffering Pin
Luksky28-May-06 0:29
Luksky28-May-06 0:29 
AnswerRe: Double buffering Pin
Hamid_RT28-May-06 1:29
Hamid_RT28-May-06 1:29 

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.