Hello
I am a beginner at programming using system calls in C. I am trying to use the execve call in one of my programs. I have to pass an integer as an argument to the program that is being invoked through execve. However, reading on the internet and seeing sample code, I can see that we can pass only strings as arguments. So, I tried converting the integer to a string using 'sprintf' and then using 'strcpy' to copy that string into one of the elements of the array of strings that has to be passed through execve. But using strcpy leads to a segmentation fault. I checked this out by debugging and if I don't use strcpy but simply write something like - myargv[1]="123"; then the entire program works fine. But since I have to pass a variable integer as a parameter and not a constant, I cannot use the above method.
This problem has been bugging me for some time. Kindly help me out as to what I should do.