Thread
:
char* argv to main - counting and termination
View Single Post
#
2
(
permalink
)
March 4th, 2007, 01:22 AM
ssawe
Registered User
Join Date: Mar 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
The cmd line args are passed to Main as an "array of pointers to cstrings". Therefore your code should be something like this to find the 0.
for ( int i=0; i< argc; i++)
{
char* arg = argv[i];
while(*arg)
{
arg++;
}
// arg now points to '\0'
}
ssawe
View Public Profile
Find all posts by ssawe