data read zeros?

This is a discussion on data read zeros? within the C++ Programming forums, part of the General Programming Boards category; When I read in a data file that is being written to by another program, do I have to wait ...

  1. #1
    Question
    Guest

    Question data read zeros?

    When I read in a data file that is being written to by another program, do I have to wait unitl it is done writing to display the data? Or could I display the data as it is being writen? Currently I can read a portion of the written file correctly, but it stops and prints out zeros when the data file is still being written to with valid data.


    Code:
    //program that is reading in
    
     float input;
    
       /*open data file*/
    
         ifstream inFile("output");
       //inFile.seekg(0,ios::cur);
    
       inFile >> input;
       while(!inFile.eof())
      {
      inFile >> input;
       data.push_back(input); //vector
      inFile >> input;
     
        }
    Thanks

  2. #2
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    Please don't double post, or both of your posts might get deleted. Just stick to this thread.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  3. #3
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,825
    Sorry - I probably confused you when I moved the other post to this board. You can ask the questions on the other thread.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. "sorting news" assignment
    By prljavibluzer in forum C Programming
    Replies: 7
    Last Post: 02-06-2008, 05:45 AM
  2. I need help as soon as possible.
    By hyrule in forum C++ Programming
    Replies: 7
    Last Post: 11-09-2005, 04:49 PM
  3. read data from file
    By matth in forum C++ Programming
    Replies: 3
    Last Post: 04-21-2005, 09:37 AM
  4. C diamonds and perls :)
    By Carlos in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 05-16-2003, 10:19 PM
  5. Read data from file !!!
    By frankiepoon in forum C Programming
    Replies: 2
    Last Post: 10-14-2002, 11:45 PM

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