Click here to Skip to main content
15,893,486 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralRe: Can I use std::tr1::share_ptr in VS2008 SP1 to replace auto_ptr in my project? Pin
hawkgao012922-Jul-09 22:03
hawkgao012922-Jul-09 22:03 
GeneralRe: Can I use std::tr1::share_ptr in VS2008 SP1 to replace auto_ptr in my project? Pin
hawkgao012922-Jul-09 22:13
hawkgao012922-Jul-09 22:13 
GeneralRe: Can I use std::tr1::share_ptr in VS2008 SP1 to replace auto_ptr in my project? Pin
Stuart Dootson22-Jul-09 22:18
professionalStuart Dootson22-Jul-09 22:18 
Questionifstream read() logic? Pin
John R. Shaw13-Jul-09 9:32
John R. Shaw13-Jul-09 9:32 
AnswerRe: ifstream read() logic? Pin
Stuart Dootson13-Jul-09 13:10
professionalStuart Dootson13-Jul-09 13:10 
GeneralRe: ifstream read() logic? Pin
John R. Shaw13-Jul-09 19:38
John R. Shaw13-Jul-09 19:38 
GeneralRe: ifstream read() logic? Pin
Stuart Dootson13-Jul-09 21:19
professionalStuart Dootson13-Jul-09 21:19 
GeneralRe: ifstream read() logic? [modified] Pin
John R. Shaw14-Jul-09 7:11
John R. Shaw14-Jul-09 7:11 
If an error occurs before the number of elements requested is read then both eofbit and failbit are set. This is done whether you reach the end of file or not, because all the read method knows is the number of elements read and is therefore guessing.

// The standard read pattern
amountRead = rdbuf()->sgetn(pElements, amountRequested);
GCount += amountRead;
if( amountRead != amountRequested )
	State |= eofbit | failbit; // Read error. Hmm! We must be at EOF (Good Guess, but not always true)

// In: vc6 STL - istream standard header
_St |= eofbit | failbit;

// In:  .Net 2003 STL
State |= ios_base::eofbit | ios_base::failbit;	// short read

// In: GNU ISO C++ Library
__err |= (ios_base::eofbit | ios_base::failbit);


I do know it terminated because of a read error, but since we can not know how many characters the encoded source data represents, we can not avoid the error. Therefore we do not know if it is an attempt to read the EOF or an encoding error.

INTP
"Program testing can be used to show the presence of bugs, but never to show their absence." - Edsger Dijkstra
"I have never been lost, but I will admit to being confused for several weeks. " - Daniel Boone

modified on Tuesday, July 14, 2009 2:36 PM

QuestionChevron effect not showing Icon in IE6 (Windows XP) Pin
am 200913-Jul-09 5:24
am 200913-Jul-09 5:24 
AnswerRe: Chevron effect not showing Icon in IE6 (Windows XP) Pin
Gerald Schwab10-Aug-09 18:29
Gerald Schwab10-Aug-09 18:29 
GeneralRe: Chevron effect not showing Icon in IE6 (Windows XP) Pin
am 20094-Nov-09 22:25
am 20094-Nov-09 22:25 
QuestionSingle instance setting for out-of-proc COM server? Pin
WayneS13-Jul-09 3:25
WayneS13-Jul-09 3:25 
QuestionHelp,About Picture Stock Property in ATL Pin
Pearson_Bee12-Jul-09 21:01
Pearson_Bee12-Jul-09 21:01 
QuestionAnother 8001010e question! Pin
Kannan Ramanathan11-Jul-09 7:13
Kannan Ramanathan11-Jul-09 7:13 
AnswerRe: Another 8001010e question! Pin
Stuart Dootson11-Jul-09 7:30
professionalStuart Dootson11-Jul-09 7:30 
GeneralRe: Another 8001010e question! Pin
Kannan Ramanathan11-Jul-09 7:41
Kannan Ramanathan11-Jul-09 7:41 
GeneralRe: Another 8001010e question! Pin
Stuart Dootson11-Jul-09 7:52
professionalStuart Dootson11-Jul-09 7:52 
GeneralRe: Another 8001010e question! Pin
Kannan Ramanathan11-Jul-09 18:23
Kannan Ramanathan11-Jul-09 18:23 
GeneralRe: Another 8001010e question! Pin
Stuart Dootson11-Jul-09 23:37
professionalStuart Dootson11-Jul-09 23:37 
GeneralRe: Another 8001010e question! Pin
Kannan Ramanathan11-Jul-09 23:43
Kannan Ramanathan11-Jul-09 23:43 
GeneralRe: Another 8001010e question! Pin
Stuart Dootson11-Jul-09 23:47
professionalStuart Dootson11-Jul-09 23:47 
GeneralRe: Another 8001010e question! Pin
Kannan Ramanathan12-Jul-09 1:57
Kannan Ramanathan12-Jul-09 1:57 
GeneralRe: Another 8001010e question! Pin
Stuart Dootson12-Jul-09 5:48
professionalStuart Dootson12-Jul-09 5:48 
GeneralRe: Another 8001010e question! Pin
Member 348023215-Jul-09 0:51
Member 348023215-Jul-09 0:51 
QuestionVC6 problem: locale loc(locale::classic(), new myfac) Pin
John R. Shaw9-Jul-09 20:51
John R. Shaw9-Jul-09 20:51 

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.