Posts Tagged ‘c++’

C++ not reading in integers: Windows vs Mac error?

Friday, November 6th, 2009

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?

Random Rumblings

Saturday, July 11th, 2009

Was reading through my mailing lists and found this one in the Drizzle mailing list when talking about code styling for c++, pretty interesting read “Join Strike Air Fighter Vehicle C++ Coding Standards”

http://www.research.att.com/~bs/JSF-AV-rules.pdf

Another random musing when I was working on a rails project:
Even if your using the default environment for a cron job, you need to put RAILS_ENV=env /path/to/ruby etc…. in the command line for it to work (at least on CentOS)

© 2008 Josh Rendek.