Why this simple pgm wont run

This is a discussion on Why this simple pgm wont run within the A Brief History of Cprogramming.com forums, part of the Community Boards category; #include <stdlib.h> #include <stdio.h> #include <string.h> main() { char child1[] = "ftp -i -v -s:z:\AAA\test\scr1"; system (child1); } --------- my ...

  1. #1
    Registered User
    Join Date
    Jul 2003
    Posts
    3

    Smile Why this simple pgm wont run

    #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

  2. #2
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    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?

  3. #3
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    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";
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  4. #4
    Registered User
    Join Date
    Jul 2003
    Posts
    3
    Thanks Sean and Hammer

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

  5. #5
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    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
    Code:
    #include <stdlib.h> 
    
    main()
    {
              System("ftp -i -v -s:z:\\AAA\\test\\scr1");
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. 2 simple C++ probs
    By alikoolg in forum C++ Programming
    Replies: 4
    Last Post: 03-18-2009, 10:02 PM
  2. Possibly simple question
    By PAragonxd in forum C++ Programming
    Replies: 1
    Last Post: 09-14-2008, 03:43 AM
  3. Having only one function run at higher priority
    By ulillillia in forum C Programming
    Replies: 35
    Last Post: 02-24-2008, 06:56 PM
  4. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 04:00 PM
  5. Pong - Simple question
    By Akilla in forum Game Programming
    Replies: 9
    Last Post: 07-20-2002, 04:42 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21