Click here to Skip to main content
14,768,148 members
Home » Discussions » C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: having problem to find an error Pin
David Crow29-Dec-20 4:14
MemberDavid Crow29-Dec-20 4:14 
AnswerRe: having problem to find an error Pin
Patrice T30-Dec-20 13:42
mvePatrice T30-Dec-20 13:42 
Questiongdi+ bitmap save on existing file - showing error Pin
Gopi Nath24-Dec-20 23:21
MemberGopi Nath24-Dec-20 23:21 
AnswerRe: gdi+ bitmap save on existing file - showing error Pin
Richard MacCutchan25-Dec-20 0:33
mveRichard MacCutchan25-Dec-20 0:33 
GeneralSolved - gdi+ bitmap save on existing file - showing error Pin
Gopi Nath25-Dec-20 0:53
MemberGopi Nath25-Dec-20 0:53 
Questionstd:strstream does not work Pin
Haakon S.22-Dec-20 3:38
MemberHaakon S.22-Dec-20 3:38 
AnswerRe: std:strstream does not work Pin
Richard MacCutchan22-Dec-20 5:14
mveRichard MacCutchan22-Dec-20 5:14 
GeneralRe: std:strstream does not work Pin
Haakon S.22-Dec-20 23:21
MemberHaakon S.22-Dec-20 23:21 
Ok, some details. Everything seems to be identical when I check the debug data. The text file is referenced in the same way by filebuf.

The first member of CComponent is specified as WORD m_nNo and the this value in the first component is 56.

I put some test code on top of my function to try to find out what is going on.


std::strstream& operator>>(std::strstream& Stream,CComponent* pCmp){
	char txt[4];
	Stream >> txt;
.
.
.
}


The watch window displays the following output from the new C++ version:

- txt 0x00cfd5fc "" char[4]
[0] 0 '\0' char
[1] -52 'Ì' char
[2] -52 'Ì' char
[3] -52 'Ì' char

From my older version I get the correct output:

- txt 0x0055e25c "56" char[4]
[0] 53'5' char
[1] 54'6' char
[2] 0 '\0' char
[3] -52 'Ì' char

It seems that the extraction operator >> simply does not work anymore. In that case, what is the best alternative for reading data from a text file. If I replace strstream with stringstream I get the message that stringstream does not have a >> operator.

modified 23-Dec-20 4:35am.

GeneralRe: std:strstream does not work Pin
Richard MacCutchan23-Dec-20 0:37
mveRichard MacCutchan23-Dec-20 0:37 
GeneralRe: std:strstream does not work Pin
Stefan_Lang24-Dec-20 0:59
mveStefan_Lang24-Dec-20 0:59 
AnswerRe: std:strstream does not work Pin
Stefan_Lang24-Dec-20 0:56
mveStefan_Lang24-Dec-20 0:56 
GeneralRe: std:strstream does not work Pin
Haakon S.24-Dec-20 1:37
MemberHaakon S.24-Dec-20 1:37 
GeneralRe: std:strstream does not work Pin
Richard MacCutchan24-Dec-20 5:18
mveRichard MacCutchan24-Dec-20 5:18 
GeneralRe: std:strstream does not work Pin
Stefan_Lang24-Dec-20 6:10
mveStefan_Lang24-Dec-20 6:10 
GeneralRe: std:strstream does not work Pin
Haakon S.24-Dec-20 12:59
MemberHaakon S.24-Dec-20 12:59 
AnswerRe: std:strstream does not work. Solution (sort of) Pin
Haakon S.26-Dec-20 2:11
MemberHaakon S.26-Dec-20 2:11 
GeneralRe: std:strstream does not work. Solution (sort of) Pin
Randor 26-Dec-20 4:28
professional Randor 26-Dec-20 4:28 
QuestionConfigure Script Issue Pin
jblixt21-Dec-20 13:37
professionaljblixt21-Dec-20 13:37 
AnswerRe: Configure Script Issue Pin
Randor 21-Dec-20 14:01
professional Randor 21-Dec-20 14:01 
AnswerRe: Configure Script Issue Pin
k505421-Dec-20 18:42
mvek505421-Dec-20 18:42 
QuestionWriting a Factory Design Pattern Program with separate Header Files and Class Implementations Pin
Litu Sahoo17-Dec-20 13:26
MemberLitu Sahoo17-Dec-20 13:26 
AnswerRe: Writing a Factory Design Pattern Program with separate Header Files and Class Implementations Pin
Gerry Schmitz17-Dec-20 20:27
mveGerry Schmitz17-Dec-20 20:27 
AnswerRe: Writing a Factory Design Pattern Program with separate Header Files and Class Implementations Pin
Richard MacCutchan18-Dec-20 0:36
mveRichard MacCutchan18-Dec-20 0:36 
QuestionBeginning C++ for Windows Application Pin
chipp_zanuff13-Dec-20 7:06
Memberchipp_zanuff13-Dec-20 7:06 
AnswerRe: Beginning C++ for Windows Application Pin
Gerry Schmitz13-Dec-20 7:19
mveGerry Schmitz13-Dec-20 7:19 

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.