Thread: Calling program with variables

  1. #1
    Registered User
    Join Date
    May 2020

    Calling program with variables

    Hello, i need to call a program from terminal while entering some strings or files (the strings are names of files that i need to open later) into the program at the same time, like this:

    ./codificar TablaDeCodificacion.txt completo.txt completoCodificado [ENTER]
    but if i use scanf() i need to call the program like this:
    ./codificar [ENTER]

    TablaDeCodificacion.txt [ENTER]

    completo.txt [ENTER]

    completoCodificado [ENTER]

    does someone know how to do that?

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Read this website's tutorial on command line arguments.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 5
    Last Post: 02-02-2013, 09:33 PM
  2. Replies: 1
    Last Post: 03-03-2009, 04:47 PM
  3. Calling non-static functions on static variables
    By pandu in forum C++ Programming
    Replies: 14
    Last Post: 06-19-2008, 03:07 AM
  4. Calling one program from another
    By sureshkumarct in forum C Programming
    Replies: 1
    Last Post: 01-09-2007, 06:35 AM
  5. Calling a function with 50 input variables
    By thetinman in forum C Programming
    Replies: 6
    Last Post: 10-18-2006, 11:32 AM

Tags for this Thread