tags:

views:

72

answers:

1
argv[1]=argv[1]/filenames[j]

argv[1]=folder1
and filenames[2]=cool

I want to store folder1/cool in argv[1] how to proceed? I am not familiar with C.

+3  A: 
  1. you should be using "folder1" and "cool" if these are litterals
  2. you should use strcat(str1, str2) if you want to mimmic str1 = str1 + str2 of e.g. Java
  3. you might prefer sprintf(str1, "%s/%s","folder","cool")
  4. none of the above is correct unless str1 is an array of char that has enough room to store the result (welcome to C)
sylvainulg
Thanks a lot! That really helped. I am really embarrassed asking such a noob question.
Karthik Kottapalli
char holder[xxx]; snprintf(holder, xxx, "%s/%s", basename, filename);that would be my favourite way to handle something alike unless the content of "holder" needs to have a wider scope than the current function.
sylvainulg