Should command line arguments have a null termination at the end?
The book I'm studying (Ivor Horton's Beginning C++) says they will, but my test of the code in his book shows that the null is not there.
Interestingly, in viewing the hex editor while debugging, I see that there is a "0" between each char array. For example, my command line is such:
"c:\myProgram.exe help me debug this"
then the char* array arguments, (char* argv) shows like this in the hex editor:
But none of these zeros are detectable in my loop, which looks for the 0 value to end looping.
corn-fused in Indiana,
int main(int argc, char* argv)
cout << endl;
int i = 0;
while(argv[i] != '\0')
cout << (i+1) << ": " << *argv[i] << " and string: " << argv[i++] << endl;
cout << "argc = " << argc << endl;
cout << "sizeof char* argv= " << (sizeof argv) << endl;