how to append a character on argv[]?
Hello Guys, I m trying to append a character on each argv[].
buffer[256] = ""; for(i = 1; i < argc; i++) { strcat(argv[i],";"); strcat(buffer,argv[i]); } printf("buffer is %s", buffer); If I type ./app hello there here, I want to have the buffer which is like hello;there;here But the code above seems doens't work. Any idea that how can I append a character at the end of each argv? |
You can't add to strings that don't have free space allocated. This should work.
Code:
strcat(buffer,argv[i]); |
Quote:
george; ; what; |
Quote:
thanks! |
All times are GMT -5. The time now is 02:55 PM. |