Click here to Skip to main content
15,888,009 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: doubt in CFile Pin
Jonathan Davies9-Dec-09 7:40
Jonathan Davies9-Dec-09 7:40 
GeneralRe: doubt in CFile Pin
Richard MacCutchan9-Dec-09 8:46
mveRichard MacCutchan9-Dec-09 8:46 
AnswerRe: doubt in CFile Pin
Wes Aday9-Dec-09 6:53
professionalWes Aday9-Dec-09 6:53 
AnswerRe: doubt in CFile Pin
krmed9-Dec-09 6:58
krmed9-Dec-09 6:58 
GeneralRe: doubt in CFile Pin
Rakesh59-Dec-09 7:19
Rakesh59-Dec-09 7:19 
AnswerRe: doubt in CFile Pin
2249179-Dec-09 7:00
2249179-Dec-09 7:00 
AnswerRe: doubt in CFile Pin
David Crow9-Dec-09 7:10
David Crow9-Dec-09 7:10 
GeneralRe: doubt in CFile Pin
Mattias G9-Dec-09 10:39
Mattias G9-Dec-09 10:39 
I you'd prefer the text format over the CRecordset/Automation approaches, you could use a tab character ("\t") or a comma to separate the cells, and a newline to separate the rows. If you only use the CFile::modeCreate flag when opening the file, the file gets truncated to zero length, effectively overwriting your data. Have a look at CFile::modeNoTruncate. Something like this:

CFile theFile;
theFile.Open(_T("example.txt"), CFile::modeCreate|CFile::modeNoTruncate|CFile::modeWrite, NULL);
CString strOut = _T("Row1Col1\tRow1Col2\tRow1Col3\r\nRow2Col1\tRow2Col2\tRow2Col3");
theFile.Write(strOut, strOut.GetLength() * sizeof(TCHAR));


Note how the file name extension is "txt", you can still open it in Microsoft Excel by right-clicking it. Or you could keep the "xls" extension and keep pretending it's a real binary Excel file. No user will ever notice Smile | :)
GeneralRe: doubt in CFile Pin
Paulraj G9-Dec-09 17:15
Paulraj G9-Dec-09 17:15 
QuestionopenGL can read an bmf picture or another picture ???? Pin
a04.lqd9-Dec-09 4:17
a04.lqd9-Dec-09 4:17 
AnswerRe: openGL can read an bmf picture or another picture ???? Pin
Cedric Moonen9-Dec-09 4:23
Cedric Moonen9-Dec-09 4:23 
GeneralRe: openGL can read an bmf picture or another picture ???? Pin
a04.lqd9-Dec-09 9:44
a04.lqd9-Dec-09 9:44 
GeneralRe: openGL can read an bmf picture or another picture ???? Pin
Cedric Moonen9-Dec-09 20:15
Cedric Moonen9-Dec-09 20:15 
QuestionFile Associations under Vista and up... Pin
Code-o-mat9-Dec-09 3:54
Code-o-mat9-Dec-09 3:54 
AnswerRe: File Associations under Vista and up... Pin
David Crow9-Dec-09 4:18
David Crow9-Dec-09 4:18 
GeneralRe: File Associations under Vista and up... Pin
Code-o-mat10-Dec-09 4:36
Code-o-mat10-Dec-09 4:36 
Question0xC0000005: Access Violation Pin
kir_MFC9-Dec-09 2:26
kir_MFC9-Dec-09 2:26 
AnswerRe: 0xC0000005: Access Violation Pin
CPallini9-Dec-09 2:38
mveCPallini9-Dec-09 2:38 
AnswerRe: 0xC0000005: Access Violation Pin
Cedric Moonen9-Dec-09 3:05
Cedric Moonen9-Dec-09 3:05 
Questionerror with c program Pin
kir_MFC9-Dec-09 1:15
kir_MFC9-Dec-09 1:15 
AnswerRe: error with c program Pin
Cedric Moonen9-Dec-09 1:32
Cedric Moonen9-Dec-09 1:32 
AnswerRe: error with c program Pin
Rajesh R Subramanian9-Dec-09 1:39
professionalRajesh R Subramanian9-Dec-09 1:39 
QuestionRe: error with c program Pin
David Crow9-Dec-09 2:11
David Crow9-Dec-09 2:11 
QuestionSMS Sending programme Pin
trioum9-Dec-09 1:03
trioum9-Dec-09 1:03 
AnswerRe: SMS Sending programme Pin
Garth J Lancaster10-Dec-09 1:03
professionalGarth J Lancaster10-Dec-09 1:03 

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.