Quote Originally Posted by linuxnovice View Post
...
Yes I see that. So I just wrap my code in php?
Yep... highlight your code, then select the icon. Or just manually wrap the code section in tags (similar to the ones you see when you quote me!)

Quote Originally Posted by linuxnovice View Post
Yes that worked. Thanks. The code compiled without any errors. Could you please explain to me what happened that it compiled without errors?
Apparently the playerc++ code is not fully ISO-C++ compliant. Damn those open-source developers; real slackers.

Quote Originally Posted by linuxnovice View Post
Well, the only global variable that I have is goal but I need that to pass to parse_args() (maybe its because I am using sscanf).
Either pass the 'goal' as a parameter to parse_args(), or encapsulate it within a class (then pass the class as an arg to parse_args()).

Quote Originally Posted by linuxnovice View Post
Second, the reason I am using sscanf is because I need to check the type and range of the command line input, so I use the sscanf return value to do that. I dont know whether the other functions can be used to do the same thing.
As stated earlier, istringstream.

PHP Code:
#include <sstream>

...

std::istringstream iss(argv[1]);
float value 0.0;

iss >> value;

if (!
iss.fail())
{
  
std::cout << "value = " << value << std::endl;
}
else
{
  
std::cout << "You did not enter a float!" << std::endl;
}
... 
Using getopt() and strtod() would also be effective.