{ Josh Rendek }

<3 Ruby & Go

Well I was doing some homework today in XCode and ran across a strange error…

Assume the first line of the file is an integer, lets say 127

ifstream inFile;
int number;
inFile >> number;
You would think, on both windows and mac this would store 127 in number. Only on windows. On my mac it would read in 0 as the value.

On mac (specifically in xcode) to get that number…

ifstream inFile;
int num;
string temp_num;
inFile >> temp_num;
num = atoi(temp_num.c_str());
Interesting little bug, or perhaps design choice?

comments powered by Disqus