URGENT - fstream

This is a discussion on URGENT - fstream within the C++ Programming forums, part of the General Programming Boards category; I need to open a file to read to and write to at the same time. I cant do infile.open(....) ...

  1. #1
    Registered User
    Join Date
    Jan 2004
    Posts
    32

    URGENT - fstream

    I need to open a file to read to and write to at the same time.
    I cant do

    infile.open(....)
    outfile.open(...)
    ...
    ...
    ..
    outfile.close();
    infile.close();


    It there a way to do this??

  2. #2
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    Write and read at the exact same time? I don't see why you would need to, and I don't know of any way to do it.
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  3. #3
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Look into the fstream class.
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  4. #4
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,807
    Heres a link to a good tut about file I/O
    File I/O Tutorial
    For your case check out the link on Managing I/O streams
    Woop?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Fstream. I/O
    By kevinawad in forum C++ Programming
    Replies: 2
    Last Post: 07-07-2008, 09:19 AM
  2. using fstream
    By swgh in forum C++ Programming
    Replies: 1
    Last Post: 02-11-2006, 03:53 AM
  3. ARGH! fstream errors
    By OttoDestruct in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2004, 10:37 PM
  4. Are fstream and ofstream incompatible?
    By johnnyd in forum C++ Programming
    Replies: 5
    Last Post: 03-19-2003, 11:21 AM
  5. Problems with fstreams.
    By mosdef in forum C++ Programming
    Replies: 7
    Last Post: 06-19-2002, 03:36 PM

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