Connecting Tech Pros Worldwide Help | Site Map

end of file problem

  #1  
Old July 21st, 2008, 02:45 PM
xyz
Guest
 
Posts: n/a
hi all, i have a small question !! for example
ifstream filein(par("fileName"));

i have 3 clients taking three different input files which are of
different sizes. My 3 clients share the same
function to open the file and reading line by line.. my problem is i
need to ...to finish my simulation after i read the whole 3 files
completely

with filein.eof() , if at certain time my event is at module client
1...it checkes whether the file is at end then if yes simulation is
terminated othewise continues.....if simulation is terminated , i am
loosing remaining lines in client 2 and client 3's input files...

how to resolve this issue
thanks to all
  #2  
Old July 21st, 2008, 03:35 PM
Mirco Wahab
Guest
 
Posts: n/a

re: end of file problem


xyz wrote:
Quote:
hi all, i have a small question !! for example
ifstream filein(par("fileName"));
>
i have 3 clients taking three different input files which are of
different sizes. My 3 clients share the same
function to open the file and reading line by line.. my problem is i
need to ...to finish my simulation after i read the whole 3 files
completely
>
with filein.eof() , if at certain time my event is at module client
1...it checkes whether the file is at end then if yes simulation is
terminated othewise continues.....if simulation is terminated , i am
loosing remaining lines in client 2 and client 3's input files...
>
how to resolve this issue
You speak in riddles.

You have three threads, that somehow enter one
function at the same time. OK?

Each of the threads does then simultaneously create
a local std::ifstream file object in this function and each
thread then opens a different physical file for reading
through it, OK?

You came to the conclusion, that the threads and
their corresponding std::eof()'s don't properly
stop to read their files at their end - but rather
mess with the contents of the other files and give
wrong answers, OK?

Can you show the code - where this happens? Can you
copy the declaration of all variables involved - we
need to see *exactly* like it looks in your real code?

Regards

M.
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
end of file problem xyz answers 1 July 21st, 2008 03:15 PM
end-of-file problem Markus Pitha answers 29 September 4th, 2006 05:25 AM
EOF (end of file) problem Karlo Basic answers 5 July 19th, 2005 08:52 PM