Thread: how to input text to c program in cmd

  1. #1
    Registered User
    Join Date
    Oct 2013
    Posts
    11

    Lightbulb how to input text to c program in cmd

    how to input text to c program in cmd ( for example my program will get input from a text file )Thanks

  2. #2
    Ultraviolence Connoisseur
    Join Date
    Mar 2004
    Posts
    555

  3. #3
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    if program is run as
    Code:
    ./prog < file.txt
    you can just read input from stdio
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  4. #4
    Registered User
    Join Date
    Oct 2013
    Posts
    11
    I can not understand you when I do name_file.exe < file.txt it's give me error

  5. #5
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    what gives you an error?
    which error is it?
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Input of a Text File
    By Chemeng11 in forum C++ Programming
    Replies: 2
    Last Post: 05-01-2011, 10:13 AM
  2. help with text input
    By Alphawaves in forum C Programming
    Replies: 8
    Last Post: 04-08-2007, 04:54 PM
  3. Need help with Text Input
    By CrazyDesi in forum C Programming
    Replies: 3
    Last Post: 08-07-2005, 12:24 PM
  4. Text input
    By Quantrizi in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 07-30-2002, 04:49 AM
  5. Problem with text input
    By newbie in forum C++ Programming
    Replies: 2
    Last Post: 03-10-2002, 04:44 PM

Tags for this Thread