Originally Posted by
Programmer_P
Ok, another problem dealing with argv:
When I get the argv[1] argument and store it in a string, I then get the size of the string by calling the size() function of that string.
Later on in the code, I was noticing it was outputting the wrong message at was supposed to be the last character of the string (i.e. inputFilePathSize - 1). And so I went and outputted the size of the inputFilePath string (which is the string which was given the contents of argv[1]), and it turns out that size is 2 less than what it should be.
It claims the length/size of the string is 32, when in reality, its 34. It also gets the size of argv[2] (an output filename string) wrong. It claims it has 7 characters, when in reality, it has 9.
With both strings, I depending on the size() function of the string type, and store what that function returns inside an int. Is that the problem? I know that string::size() returns a size_t type which is an unsigned type as opposed to "int" which is a signed type. I don't know if that would change the inner value though. I was under the impression it wouldn't, which is why I'm using an int variable instead of a size_t for storing the size.