C++ code to run a command line

This is a discussion on C++ code to run a command line within the C++ Programming forums, part of the General Programming Boards category; Hi all. A newbie here! Last time it touch C/C++ was about 15 years ago so now I am all ...

  1. #1
    Registered User
    Join Date
    Sep 2012
    Posts
    1

    C++ code to run a command line

    Hi all. A newbie here!
    Last time it touch C/C++ was about 15 years ago so now I am all rusted up.
    What I am after is a simple C++ code to run a ftp command to connected to a server then login and download a file so something like:

    ftp servername
    user bob
    pass bob
    put file.txt
    quit
    bye

    I know I can do a FTP command line like ftp servername -b script.txt
    to execute the above, but I would like to do it without showing the ouput on screen

    I have downloaded Quincy 2005 but can download another if needed.
    Thanks
    John

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,434
    What about
    ftp servername -b script.txt 1>NUL

    Or even
    ftp servername -b script.txt 1>NUL 2>NUL
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 17
    Last Post: 09-03-2011, 02:40 PM
  2. Trouble with command-line arguments in C code (Linux)
    By NumLock in forum C Programming
    Replies: 2
    Last Post: 07-26-2011, 05:31 PM
  3. Command line how to handle optional command.
    By ovid in forum C++ Programming
    Replies: 1
    Last Post: 03-07-2010, 10:41 PM
  4. Run command line code from within my c code.
    By baikal_m in forum C Programming
    Replies: 6
    Last Post: 01-28-2010, 02:58 PM
  5. Command Line Code
    By smitsky in forum C++ Programming
    Replies: 6
    Last Post: 09-11-2004, 07:35 AM

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