Who to redirect stdout to a file in C

This is a discussion on Who to redirect stdout to a file in C within the Linux Programming forums, part of the Platform Specific Boards category; Hi, I want to know how can I redirect stdout to a file/socket in C. Thanks in advance...

  1. #1
    Registered User
    Join Date
    Sep 2004
    Posts
    13

    Who to redirect stdout to a file in C

    Hi,

    I want to know how can I redirect stdout to a file/socket in C.

    Thanks in advance

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,485
    Read the manual pages for
    close()
    dup()
    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.

  3. #3
    Registered User linuxdude's Avatar
    Join Date
    Mar 2003
    Location
    Louisiana
    Posts
    926
    Code:
    ./program > file.txt

  4. #4
    SleepWalker tjohnsson's Avatar
    Join Date
    Apr 2004
    Posts
    70
    Code:
    freopen( ... )
    -- Add Your Signature Here --

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. File transfer- the file sometimes not full transferred
    By shu_fei86 in forum C# Programming
    Replies: 13
    Last Post: 03-13-2009, 12:44 PM
  2. Replies: 3
    Last Post: 03-04-2005, 01:46 PM
  3. Possible circular definition with singleton objects
    By techrolla in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2004, 09:46 AM
  4. Making a LIB file from a DEF file for a DLL
    By JMPACS in forum C++ Programming
    Replies: 0
    Last Post: 08-02-2003, 08:19 PM
  5. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 10:12 PM

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