Following is my small code snippet using getopt that works well on my linux machine, but not on solaris machine. It is standard code snippet that I found else where in the internet.
while ((c = getopt(argc, argv, "ab:")) != -1) {
cout << "I am solaris, I dont come here \n";
switch(c) {
case 'a':
case 'b':
}
}
Now there is no problem on my linux machine. It does good job. But on my solaris machine, it does not even go inside the while loop, so it does not parse anything for me. I checked "man getopt" on my solaris machine (as I think getopt in shell is used), It just says getopt will not be supported in the next major release.
So How I could i make it work on my solaris machine. I dont want to use boost.
Thanks D. L. Kumar
man getopton Solaris tells yougetoptwon't be supported in the next major release, it's talking about the shell command, not the C function. For that, runman -s3c getopt.