that's funny, I thought the name of the list had some actual meaning -
mingw64-users meant it was for users of mingw64. I guess I was wrong and its
meaningless.
>________________________________
> From: Ruben Van Boxem <[email protected]>
>To: [email protected]
>Sent: Wednesday, April 25, 2012 2:25 PM
>Subject: Re: [Mingw-w64-public] ifstream reads once too many times?
>
>
>Op 25 apr. 2012 23:07 schreef "Jim Michaels" <[email protected]> het volgende:
>>
>>
>> #include <fstream>
>> #include <iostream>
>> int main(int argc, char * argv[], char * envp[]) {
>> int n;
>> std::ifstream filein;
>> filein.open("somefile.txt", std::ifstream::in);
>> if (!filein.good()) {
>> filein.close();
>> std::cerr << "ERROR: unable to open file \"somefile.txt\"" <<
>> std::endl;
>> return 1;
>> }
>> filein >> n;
>> if (filein.good()) {
>> std::cout << n << std::endl;
>> }
>> while (filein.good()) {
>> std::cout << n << std::endl;
>> filein >> n;
>> }
>> filein.close();
>> return 0;
>> }
>>
>> somefile.txt contains a 1
>> but mingw-w64 outputs
>> 1
>> 1
>> this happens with 20111127. it happens with
>>
>> I have tried rearranging this to
>> #include <fstream>
>> #include <iostream>
>> int main(int argc, char * argv[], char * envp[]) {
>> int n;
>> std::ifstream filein;
>> filein.open("somefile.txt", std::ifstream::in);
>> if (!filein.good()) {
>> filein.close();
>> std::cerr << "ERROR: unable to open file \"somefile.txt\"" <<
>> std::endl;
>> return 1;
>> }
>> if (filein.good()) {
>> filein >> n;
>> std::cout << n << std::endl;
>> }
>> while (filein.good()) {
>> filein >> n;
>> std::cout << n << std::endl;
>> }
>> filein.close();
>> return 0;
>> }
>>
>> but it makes no difference. same result. this also happens with mingw also.
>http://lmgtfy.com/?q=c%2B%2B+getline+one+line+too+many
>This is not the first time I'm telling you this: this is not a general
>programming question mailing list.
>This has to be the most easy thing to Google...
>Ruben
>>
>>
>>
>> -------------
>> Jim Michaels
>> [email protected]
>> [email protected]
>> http://JimsComputerRepairandWebDesign.com
>> http://JesusnJim.com (my personal site, has software)
>> ---
>> Computer memory measurements, SSD measurements, microsoft disk size
>> measurements (note: they will say GB or MB or KB or TB when it is not!):
>> [KiB] [MiB] [GiB] [TiB]
>> [2^10B=1,024B=1KiB]
>> [2^20B=1,048,576B=1MiB]
>> [2^30B=1,073,741,824B=1GiB]
>> [2^40B=1,099,511,627,776B=1TiB]
>> hard disk industry disk size measurements:
>> [KB] [MB] [GB] [TB]
>> [10^3B=1,000B=1KB]
>> [10^6B=1,000,000B=1MB]
>> [10^9B=1,000,000,000B=1GB]
>> [10^12B=1,000,000,000,000B=1TB]
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Live Security Virtual Conference
>> Exclusive live event will cover all the ways today's security and
>> threat landscape has changed and how IT managers can respond. Discussions
>> will include endpoint security, mobile security and the latest in malware
>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>> _______________________________________________
>> Mingw-w64-public mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>>
>
>------------------------------------------------------------------------------
>Live Security Virtual Conference
>Exclusive live event will cover all the ways today's security and
>threat landscape has changed and how IT managers can respond. Discussions
>will include endpoint security, mobile security and the latest in malware
>threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>_______________________________________________
>Mingw-w64-public mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
>
>
>------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public