Click here to Skip to main content
15,905,148 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Does turning on /GS- switch make the final binary code run slower? Pin
Paul Conrad21-Aug-06 17:54
professionalPaul Conrad21-Aug-06 17:54 
GeneralRe: Does turning on /GS- switch make the final binary code run slower? Pin
Link260021-Aug-06 20:39
Link260021-Aug-06 20:39 
QuestionBreaking point Pin
Waldermort20-Aug-06 9:44
Waldermort20-Aug-06 9:44 
AnswerRe: Breaking point Pin
RChin20-Aug-06 9:53
RChin20-Aug-06 9:53 
AnswerRe: Breaking point Pin
Kevin McFarlane20-Aug-06 9:55
Kevin McFarlane20-Aug-06 9:55 
AnswerRe: Breaking point Pin
Neville Franks20-Aug-06 11:51
Neville Franks20-Aug-06 11:51 
AnswerRe: Breaking point Pin
bob1697220-Aug-06 11:58
bob1697220-Aug-06 11:58 
Question(ios::good == true) crashes the program Pin
jon-8020-Aug-06 8:52
professionaljon-8020-Aug-06 8:52 
The following errors are returned when I try to use (ios::good == true) as opposed to (ios::good != false)

Code:
void CSentenceAr::readFile(char strFileToRead[MAX_FILENAME_LENGTH])
{
char strLine[MAX_SENTENCE_LENGTH + 1];

fstream fileToRead(strFileToRead,ios::in);

if (ios::good == false) // OR if (ios::good == TRUE)
//which is defined as '1' in afx.h
{while (!fileToRead.eof() && Size < MAX_LINES)
// Read line of text from file and update Sentences.strSentence.
{ fileToRead.getline(strLine, MAX_SENTENCE_LENGTH);
strcpy(Sentences.strSentence[Size], strLine);

Size++;
}
}
fileToRead.close();

}

Errors:

SentenceAr.cpp(31): warning C4805: '==' : unsafe mix of type 'bool (__thiscall std::ios_base::* )(void) const' and type 'bool' in operation

SentenceAr.cpp(31): error C2446: '==' : no conversion from 'int' to 'bool (__thiscall std::ios_base::* )(void) const'

SentenceAr.cpp(31): error C2040: '==' : 'bool (__thiscall std::ios_base::* )(void) const' differs in levels of indirection from 'int'

This works though:

{
char strLine[MAX_SENTENCE_LENGTH + 1];

fstream fileToRead(strFileToRead,ios::in);
bool isItGood = ios::good;
if (ios::good != false)
{while (!fileToRead.eof() && Size < MAX_LINES)
// Read line of text from file and update Sentences.strSentence.
{ fileToRead.getline(strLine, MAX_SENTENCE_LENGTH);
strcpy(Sentences.strSentence[Size], strLine);

Size++;
}
}
fileToRead.close();

}

The IDE returns isItGood as having a 'true' value.






Jon
AnswerRe: (ios::good == true) crashes the program Pin
Michael Dunn20-Aug-06 10:38
sitebuilderMichael Dunn20-Aug-06 10:38 
GeneralRe: (ios::good == true) crashes the program Pin
jon-8021-Aug-06 5:10
professionaljon-8021-Aug-06 5:10 
QuestionClipboard change event? Pin
fklldsvs20-Aug-06 8:19
fklldsvs20-Aug-06 8:19 
AnswerRe: Clipboard change event? Pin
Ravi Bhavnani20-Aug-06 8:48
professionalRavi Bhavnani20-Aug-06 8:48 
AnswerRe: Clipboard change event? Pin
Michael Dunn20-Aug-06 10:39
sitebuilderMichael Dunn20-Aug-06 10:39 
AnswerRe: Clipboard change event? Pin
Hamid_RT20-Aug-06 20:40
Hamid_RT20-Aug-06 20:40 
QuestionCannot trap F9 key in my application!!! Pin
SanjaySMK20-Aug-06 7:56
SanjaySMK20-Aug-06 7:56 
QuestionTemplates and protected members [modified] Pin
JKallen20-Aug-06 7:46
JKallen20-Aug-06 7:46 
AnswerRe: Templates and protected members Pin
Justin Tay20-Aug-06 8:14
Justin Tay20-Aug-06 8:14 
GeneralRe: Templates and protected members Pin
JKallen20-Aug-06 8:32
JKallen20-Aug-06 8:32 
GeneralRe: Templates and protected members [modified] Pin
Justin Tay20-Aug-06 8:41
Justin Tay20-Aug-06 8:41 
GeneralRe: Templates and protected members [modified] Pin
JKallen20-Aug-06 9:11
JKallen20-Aug-06 9:11 
GeneralRe: Templates and protected members Pin
jk chan21-Aug-06 18:06
jk chan21-Aug-06 18:06 
AnswerRe: Templates and protected members Pin
Michael Dunn20-Aug-06 10:46
sitebuilderMichael Dunn20-Aug-06 10:46 
Questionios::nocreate and acces modifiers (2) Pin
jon-8020-Aug-06 7:32
professionaljon-8020-Aug-06 7:32 
AnswerRe: ios::nocreate and acces modifiers (2) [modified] Pin
Waldermort20-Aug-06 7:58
Waldermort20-Aug-06 7:58 
Questionios::nocreate Pin
jon-8020-Aug-06 7:01
professionaljon-8020-Aug-06 7:01 

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.