1 year ago
#255257
dunkirk
how can i get the length of argv[1]
not sure how I should get the string length from the argv[1], I think the problem is with the argv[i] but I can't seem to find anything to help with this
if(argc <2)
{
printf("please enter a file name!");
}
printf("%s",argv[1]);
char source[] = {argv[1]};
char destination;
int start = 0;
int len = 0;
for(int i =0; i< strlen(argv[1]);i++)
{
if(argv[i] != ' ')
len++;
}
printf("%d",len);
c
argv
strlen
0 Answers
Your Answer