Click here to Skip to main content
15,901,035 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How do you merge multiple bitmap files? Pin
KarstenK9-Dec-09 21:55
mveKarstenK9-Dec-09 21:55 
QuestionCMenu what the scrolling menu buttons named ? Pin
Maximilien9-Dec-09 9:52
Maximilien9-Dec-09 9:52 
AnswerRe: CMenu what the scrolling menu buttons named ? Pin
KarstenK9-Dec-09 21:57
mveKarstenK9-Dec-09 21:57 
QuestionCan't get local system time to show in a StatusStrip label Pin
spicture9-Dec-09 9:18
spicture9-Dec-09 9:18 
AnswerRe: Can't get local system time to show in a StatusStrip label Pin
Richard MacCutchan9-Dec-09 9:52
mveRichard MacCutchan9-Dec-09 9:52 
GeneralRe: Can't get local system time to show in a StatusStrip label Pin
spicture10-Dec-09 6:51
spicture10-Dec-09 6:51 
GeneralRe: Can't get local system time to show in a StatusStrip label Pin
Richard MacCutchan10-Dec-09 7:18
mveRichard MacCutchan10-Dec-09 7:18 
GeneralRe: Can't get local system time to show in a StatusStrip label Pin
spicture11-Dec-09 8:23
spicture11-Dec-09 8:23 
GeneralRe: Can't get local system time to show in a StatusStrip label Pin
spicture11-Dec-09 8:20
spicture11-Dec-09 8:20 
GeneralRe: Can't get local system time to show in a StatusStrip label Pin
Richard MacCutchan12-Dec-09 1:30
mveRichard MacCutchan12-Dec-09 1:30 
AnswerRe: Can't get local system time to show in a StatusStrip label Pin
loyal ginger9-Dec-09 10:37
loyal ginger9-Dec-09 10:37 
GeneralRe: Can't get local system time to show in a StatusStrip label Pin
spicture10-Dec-09 6:45
spicture10-Dec-09 6:45 
GeneralRe: Can't get local system time to show in a StatusStrip label Pin
spicture11-Dec-09 8:22
spicture11-Dec-09 8:22 
Questionmouse in openGL, double click ?? Pin
a04.lqd9-Dec-09 8:33
a04.lqd9-Dec-09 8:33 
Questiondoubt in CFile Pin
Rakesh59-Dec-09 6:27
Rakesh59-Dec-09 6:27 
AnswerRe: doubt in CFile Pin
Jonathan Davies9-Dec-09 6:51
Jonathan Davies9-Dec-09 6:51 
GeneralRe: doubt in CFile Pin
Rakesh59-Dec-09 7:23
Rakesh59-Dec-09 7:23 
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 | :)

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.