#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.
-------------
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