In message <fd7nc.27672$>, Ashe Corven
<cfitzgib@?.net.au.invalid> writes
>i need help pretty bad for this
>
>from the command line
>
>>csend string1 4233 "string2"
>
>how can i copy string1, or string2 to a char* or a string.
>
>
>for argument 4 (string2)
>
>char temp[256];
>strcpy(temp, argv[4]);
>
>this doesn't work
>------------
>int i;
>char temp[256];
>for(i=1; argv[4][i] != '"'; ++i)
>{
> temp[i] = argv[4][i];
>}
>temp[i] = '\0'
>
>neither does this - gives a seg fault on this line
>for(i=1; argv[4][i] != '"'; ++i)
>
>how do i do it. and why don't these techniques work
>
>
The four command line arguments are pointed to by:
argv[0] // pointer to the name of the program
argv[1] // pointer to string1
argv[2] // pointer to 4233
argv[3] // pointer to string2
Remember that in C (and C++) we count from 0.
--
Francis Glassborow ACCU
Author of 'You Can Do It!' see
http://www.spellen.org/youcandoit
For project ideas and contributions:
http://www.spellen.org/youcandoit/projects