Thread: Writing the out put of a program on a text file

  1. #1
    Registered User
    Join Date
    May 2012
    Location
    India
    Posts
    12

    Question Writing the out put of a program on a text file

    Hi,

    Is there a way that we can write the output of a program on a text file??????

  2. #2
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    Quote Originally Posted by Dushyant View Post
    Hi,

    Is there a way that we can write the output of a program on a text file??????
    Yes there is. Ask the internet.

  3. #3
    Registered User
    Join Date
    Mar 2011
    Posts
    546
    two ways jump out:

    1. when you run your program, redirect the output to a file $program >output.txt
    2. inside you program, instead of using printf/puts etc, open the file you want and fprintf/fputs to it

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Text File not writing?
    By ShiroiShu in forum C Programming
    Replies: 6
    Last Post: 11-29-2011, 06:36 AM
  2. Not re-writing to a text file.
    By phantom in forum C++ Programming
    Replies: 4
    Last Post: 06-22-2010, 05:52 AM
  3. Replies: 8
    Last Post: 05-05-2010, 02:43 PM
  4. Writing to a text file
    By Inept Pig in forum C Programming
    Replies: 6
    Last Post: 11-06-2002, 04:48 PM
  5. When writing to a text file how do you...
    By JamMan in forum C++ Programming
    Replies: 4
    Last Post: 12-15-2001, 02:53 PM