PDA

View Full Version : Why this simple pgm wont run



bazeemuddin
07-02-2003, 11:58 AM
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

main()
{
char child1[] = "ftp -i -v -s:z:\AAA\test\scr1";
system (child1);
}

---------
my script is in z:\AAA\test\scr1
when i run it says
did not find script Z:\AAA

Why its not lookin at script which is in z:\AAA\test\scr1

sean
07-02-2003, 01:34 PM
Well one problem is that System() is capitalized I believe. That's caused a problem for me before, but it shouldn't generate that message. What compiler are you using?

Hammer
07-02-2003, 01:36 PM
When using backslashes in your code, be sure to double them up in string literals if you want to actually output one.

Eg

>> char child1[] = "ftp -i -v -s:z:\\AAA\\test\\scr1";

bazeemuddin
07-02-2003, 02:13 PM
Thanks Sean and Hammer

I am using a free C compiler from pacific (dos based one)

sean
07-02-2003, 03:26 PM
And unless you're doing this to learn about arrays and strings, and/or arguments to functions, It'll be a lot simpler if you just have


#include <stdlib.h>

main()
{
System("ftp -i -v -s:z:\\AAA\\test\\scr1");
}