Create a file from c++ program

This is a discussion on Create a file from c++ program within the C++ Programming forums, part of the General Programming Boards category; I'm trying to create a file when i run my program. So say i want to create a file called ...

  1. #1
    System-7
    Join Date
    Nov 2005
    Posts
    65

    Create a file from c++ program

    I'm trying to create a file when i run my program. So say i want to create a file called hello.txt and put my output in it.

    What code would i write so that it would create that file?

    Thanks for any help,

    ...Dan

  2. #2
    The Richness... Richie T's Avatar
    Join Date
    Jan 2006
    Location
    Ireland
    Posts
    469
    This should explain how to do what you want
    No No's:
    fflush (stdin); gets (); void main ();


    Goodies:
    Example of fgets (); The FAQ, C/C++ Reference


    My Gear:
    OS - Windows XP
    IDE - MS Visual C++ 2008 Express Edition


    ASCII stupid question, get a stupid ANSI

  3. #3
    System-7
    Join Date
    Nov 2005
    Posts
    65
    Thanks I'll take a look at it

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. sequential file program
    By needhelpbad in forum C Programming
    Replies: 80
    Last Post: 06-08-2008, 01:04 PM
  2. Totally confused on assigment using linked lists
    By Uchihanokonoha in forum C++ Programming
    Replies: 8
    Last Post: 01-05-2008, 03:49 PM
  3. Batch file programming
    By year2038bug in forum Tech Board
    Replies: 10
    Last Post: 09-05-2005, 03:30 PM
  4. fopen();
    By GanglyLamb in forum C Programming
    Replies: 8
    Last Post: 11-03-2002, 11:39 AM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM

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