[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [CPROG] ifstream tilbage til start



Hej Dennis

>Jeg har prøvet at indsætte dette lige efter while lykken
>f.seekg (0, ios::beg);
>og så køre while lykken en gang til, men det har ingen effekt.

std::basic_iostream<.>::seekg(.) har ingen effekt hvis fail() == true
(ISO/IEC 14882:1998(E) 27.6.1.3-38)

>while (f >> s )

Denne løkke fortsætter indtil f ikke kan indlæses i s (hvorved 
fail()==true), her sker det ved EOF.
Dvs. at både eof- og fail- bit'en samtidigt bliver sat.

En løsning var at sætte state(.) til std::ios_base::goodbit hvis (state() 
& std::ios_base::eofbit) == true før kald af seekg(.).


Med venlig hilsen

Nils Åke Ljunggren


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:09 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *