开发者

How to store path names in a string in C?

开发者 https://www.devze.com 2022-12-29 15:44 出处:网络
argv[1]=argv[1]/filenames[j] argv[1]=folder1 an开发者_如何学运维d filenames[2]=cool I want to store folder1/cool in argv[1]
argv[1]=argv[1]/filenames[j]

argv[1]=folder1
an开发者_如何学运维d filenames[2]=cool

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


  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)
0

精彩评论

暂无评论...
验证码 换一张
取 消