command line/terminal arguments are driving me bananas
according to most of my google searchs this should work
by the way i am using g++/gcc version 4.6.0
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char **argv){
if(argc==0){
cout<<"Use -l or -ls!\n";
}
if(string(argv[1])== "-l"){
//code for lua interpreter
}
else if(string(argv[1]) == "-ls"){
//code for interpreting lua script
}
lua_close();
return 0;
}
instead of ./nameofprogram printing "Use -l or -ls!"
it prints nothing but the switches work just fine.
what gives ? i will post full code if necessary but i do believe the rest is functioning properly as my only problem exists with argc == 0 not doing what it should(or rather what i believe it should).
thanks in advance DW always helps me figure out whats going wrong.