bganoush
asked on
Programming Stumper...
The following code wasted 20 minutes of my time... Find the BUG!
// m_DEBUGFILE is in the class header as a CFile*
m_DEBUGFILE = new CFile();
CFileException fileException;
if ( !m_DEBUGFILE->Open( pszFileName, CFile::modeCreate | CFile::modeNoTruncate |
CFile::modeReadWrite ), &fileException )
{
// fileException.m_cause;
delete m_DEBUGFILE;
m_DEBUGFILE = NULL;
}
else
{
m_DEBUGFILE->SeekToEnd();
CString msg = "START DEBUGGING";
m_DEBUGFILE->Write(msg, msg.GetLength());
m_DEBUGFILE->Write("\r\n", 2);
}
-- Thanks to microsoft for their wonderful API docs:
See: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/HTML/_core_opening_files.asp
-- Bubba
// m_DEBUGFILE is in the class header as a CFile*
m_DEBUGFILE = new CFile();
CFileException fileException;
if ( !m_DEBUGFILE->Open( pszFileName, CFile::modeCreate | CFile::modeNoTruncate |
CFile::modeReadWrite ), &fileException )
{
// fileException.m_cause;
delete m_DEBUGFILE;
m_DEBUGFILE = NULL;
}
else
{
m_DEBUGFILE->SeekToEnd();
CString msg = "START DEBUGGING";
m_DEBUGFILE->Write(msg, msg.GetLength());
m_DEBUGFILE->Write("\r\n",
}
-- Thanks to microsoft for their wonderful API docs:
See: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/HTML/_core_opening_files.asp
-- Bubba
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
yup, looked at the sample code, the mistake was from the it.
I guess, probably they won't be basing on that code sample? after all, the documentation group is a different group from the coding group (I think).
I guess, probably they won't be basing on that code sample? after all, the documentation group is a different group from the coding group (I think).
Lol :)
It seems their sample are specifically written for the doc, as the Open would be always in error!
It seems their sample are specifically written for the doc, as the Open would be always in error!
lol!
The bug is here -----> microsoft.com
M :o)
The bug is here -----> microsoft.com
M :o)
ASKER
Good replies... and quick too!
Did you look at the sample code from Microsoft? I always wondered why I can't copy some files ... maybe microsoft actually based Windows on that sample?
-- Bubba