input output redirection

This is a discussion on input output redirection within the C Programming forums, part of the General Programming Boards category; Hi I have a file.txt which is in my documents , How can I redirect the output of that file ...

  1. #1
    Registered User
    Join Date
    Feb 2011
    Posts
    11

    input output redirection

    Hi
    I have a file.txt which is in my documents , How can I redirect the output of that file using CMD to another file namely file2.txt .

    The c program that I wrote is working but I do not know how to use input/output redirection.
    My project is saved in documents\projects and my file is in my documents what should I type or how to change the path for it to work?
    Thanks.

  2. #2
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    You're on Windows, right?

    Where is the output of the program going, now?

    If your program is "hard coded" and writing to one filename only, then I don't believe you can redirect that output to another file.

    If your program is writing it's output to the stdout (the screen usually), then it's easy to redirect the output to a file, using a terminal window (text window):

    myProgramsName >fileNameYouWant (and hit enter key)

    Is that what you wanted? I am unclear what "the output" of a text file, IS.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. input redirection
    By sashaKap in forum C Programming
    Replies: 6
    Last Post: 06-25-2009, 02:59 AM
  2. Replies: 5
    Last Post: 02-25-2008, 06:35 AM
  3. Bad output -- possible input buffer problems
    By jake123 in forum C Programming
    Replies: 8
    Last Post: 02-18-2008, 03:36 PM
  4. Using SSCANF input string output two variables
    By kevndale79 in forum C Programming
    Replies: 9
    Last Post: 10-02-2006, 03:57 PM
  5. Input & Output Explain?
    By 98dodgeneondohc in forum C Programming
    Replies: 5
    Last Post: 04-24-2005, 07:13 PM

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