Click here to Skip to main content
14,491,120 members

ATL / WTL / STL

 
AnswerRe: status display in a dialog Pin
Garth J Lancaster9-Jun-13 14:53
professionalGarth J Lancaster9-Jun-13 14:53 
Questionstd::map, fundamental get started problem RESOLVED Pin
bkelly139-Jun-13 4:04
Memberbkelly139-Jun-13 4:04 
AnswerRe: std::map, fundamental get started problem Pin
pasztorpisti9-Jun-13 4:19
professionalpasztorpisti9-Jun-13 4:19 
GeneralRe: std::map, fundamental get started problem RESOLVED Pin
bkelly139-Jun-13 4:46
Memberbkelly139-Jun-13 4:46 
QuestionCFileException, discover reasons RESOLVED Pin
bkelly138-Jun-13 10:05
Memberbkelly138-Jun-13 10:05 
AnswerRe: CFileException, discover reasons Pin
Richard MacCutchan8-Jun-13 21:40
mveRichard MacCutchan8-Jun-13 21:40 
GeneralRe: CFileException, discover reasons RESOLVED Pin
bkelly139-Jun-13 3:54
Memberbkelly139-Jun-13 3:54 
GeneralRe: CFileException, discover reasons Pin
bkelly139-Jun-13 6:11
Memberbkelly139-Jun-13 6:11 
Oops, I have a follow up on this.
Declarations:

CFileException     get_error_message;
 const unsigned int ERROR_MAX = 64;
 char  char_error_text[ ERROR_MAX ];
 LPTSTR ptr_error_text = &char_error_text[0];
 CString final_error_message = "";


Code:

m_definition_file_name += "x";
try
{
   m_definition_file.Open( m_definition_file_name, CFile::modeRead );
   get_error_message.GetErrorMessage( ptr_error_text, ERROR_MAX, NULL );
   final_error_message = char_error_text;
   error_number = GetLastError();

}
catch( CFileException e )
{ code }
catch( ... )
{ code }
{



The line m_definition_file_name += "x" forces the file name to be incorrect.

Char array char_error_text winds up with "No error occurred." while error_number gets 0 (zero)
When the line error_number = GetLastErrror is moved directly beneath the open command, it get the value 2 (two). But that consumes the last error and get_error_message does not get anything.
Nothing is thrown and neither catch is activated.

What do I need to change to use this CFileException?
Thanks for your time
If you work with telemetry, please check this bulletin board: http://www.bkelly.ws/irig_106/

GeneralRe: CFileException, discover reasons Pin
Richard MacCutchan9-Jun-13 9:23
mveRichard MacCutchan9-Jun-13 9:23 
GeneralRe: CFileException, discover reasons Pin
bkelly139-Jun-13 9:43
Memberbkelly139-Jun-13 9:43 
GeneralRe: CFileException, discover reasons Pin
Richard MacCutchan9-Jun-13 20:41
mveRichard MacCutchan9-Jun-13 20:41 
Answertried FormatMessage() Pin
bkelly139-Jun-13 7:07
Memberbkelly139-Jun-13 7:07 
AnswerStill looking for reason text Pin
bkelly1322-Jun-13 12:17
Memberbkelly1322-Jun-13 12:17 
GeneralRe: Still looking for reason text Pin
Richard MacCutchan23-Jun-13 0:51
mveRichard MacCutchan23-Jun-13 0:51 
GeneralRe: Still looking for reason text Pin
bkelly134-Jul-13 11:05
Memberbkelly134-Jul-13 11:05 
GeneralRe: Still looking for reason text Pin
Richard MacCutchan4-Jul-13 20:50
mveRichard MacCutchan4-Jul-13 20:50 
QuestionHow to force C++ allocate memory from disk? Pin
Falconapollo7-Jun-13 23:49
MemberFalconapollo7-Jun-13 23:49 
AnswerRe: How to force C++ allocate memory from disk? Pin
MicroVirus11-Jun-13 0:13
MemberMicroVirus11-Jun-13 0:13 
GeneralRe: How to force C++ allocate memory from disk? Pin
Falconapollo11-Jun-13 0:19
MemberFalconapollo11-Jun-13 0:19 
NewsProblem when apply cilk_for with ippiFFT of intel parallel Pin
tunheo5-Jun-13 23:37
Membertunheo5-Jun-13 23:37 
QuestionRemove COM Objects from VC++ projects Pin
Prashant Gupta 2413-Jun-13 20:05
MemberPrashant Gupta 2413-Jun-13 20:05 
AnswerRe: Remove COM Objects from VC++ projects Pin
Richard MacCutchan3-Jun-13 21:01
mveRichard MacCutchan3-Jun-13 21:01 
GeneralRe: Remove COM Objects from VC++ projects Pin
Prashant Gupta 2413-Jun-13 22:39
MemberPrashant Gupta 2413-Jun-13 22:39 
GeneralRe: Remove COM Objects from VC++ projects Pin
Richard MacCutchan3-Jun-13 22:51
mveRichard MacCutchan3-Jun-13 22:51 
GeneralRe: Remove COM Objects from VC++ projects Pin
Prashant Gupta 2413-Jun-13 23:30
MemberPrashant Gupta 2413-Jun-13 23:30 

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.