I am very new to C, which causes me headache as I have been working with Java all the time. I know string is array of char in C, but in this case that I am working on now, I need to convert this kind of string: cp file1 file2 Code (markup): to such array (or what is this called?) char *arg[] = {"cp", "file1", "file2", (char *) 0}; Code (markup): As I know this isnt a usual type of string, right? Because string is supposed to be array of char which only hold 1 char in each item. I need to convert that string to such "array" in order to use it in execvp() function: where cmd can be any command. It is "cp" in this case: execvp(cmd, arg); Code (markup): Any help? Thanks.
What you ought to use for this is an array of strings not an array of Chars. I only use C# and C++ myself so C is slightly a different format. Also you need to note if you're being passed in integer or floating point value numbers that you must convert them to strings either directly or indirectly