Thread: How to write data in exist text file?

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    68

    How to write data in exist text file?

    I have text file "1.txt" and there are these below hex number in text file

    "3688D9CC844E3F755"

    If I want to add another hex number like "12B5B46CA713" at new line. How to write code to do that? Thank you.
    Last edited by ooosawaddee3; 10-19-2002 at 06:11 PM.

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Start by opening a file stream... then all will become clear to you
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    Just a Member ammar's Avatar
    Join Date
    Jun 2002
    Posts
    953

    Thumbs up

    Use this:
    ifstream OpenFile(char *filename, int open_mode);

    set the open_mode to ios::app
    which will append what to write to the end of the file.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Data Structure Eror
    By prominababy in forum C Programming
    Replies: 3
    Last Post: 01-06-2009, 09:35 AM
  2. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  3. Replies: 1
    Last Post: 09-10-2005, 06:02 AM
  4. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  5. Using fscanf for reading numerical data from text file
    By Unregistered in forum C Programming
    Replies: 2
    Last Post: 06-15-2002, 05:18 PM