Connecting Tech Pros Worldwide Help | Site Map

reading and writting data problem

  #1  
Old November 21st, 2008, 04:05 AM
MJK
Guest
 
Posts: n/a
Hello,

I am reading a data file but when I try to print what I already read,
it just prints the first line of the data correctly. From the second
line, it prints 0 for integers and nothing for characters. When I
tried to print the data after every line that I read, it prints
everything OK but when I try to pint after finishing the reading, it
just prints the first line correctly! For allocating the memory, I
used new and to free it, I used delete.

I have to add that sometimes everything goes OK and sometimes I am
facing this problem. Usually it depends how big the entry data is. Any
comments?

MJK

  #2  
Old November 21st, 2008, 04:05 AM
osmium
Guest
 
Posts: n/a

re: reading and writting data problem


"MJK" wrote:
Quote:
I am reading a data file but when I try to print what I already read,
it just prints the first line of the data correctly. From the second
line, it prints 0 for integers and nothing for characters. When I
tried to print the data after every line that I read, it prints
everything OK but when I try to pint after finishing the reading, it
just prints the first line correctly! For allocating the memory, I
used new and to free it, I used delete.
>
I have to add that sometimes everything goes OK and sometimes I am
facing this problem. Usually it depends how big the entry data is. Any
comments?
Just a wild guess, but there might be a bug in your code.


  #3  
Old November 21st, 2008, 10:15 AM
Lionel B
Guest
 
Posts: n/a

re: reading and writting data problem


On Thu, 20 Nov 2008 19:56:05 -0800, MJK wrote:
Quote:
Hello,
>
I am reading a data file but when I try to print what I already read, it
just prints the first line of the data correctly. From the second line,
it prints 0 for integers and nothing for characters. When I tried to
print the data after every line that I read, it prints everything OK but
when I try to pint after finishing the reading, it just prints the first
line correctly! For allocating the memory, I used new and to free it, I
used delete.
>
I have to add that sometimes everything goes OK and sometimes I am
facing this problem. Usually it depends how big the entry data is. Any
comments?
Stock answer: there is an error on line 42 of your code.

http://www.parashift.com/c++-faq-lit...t.html#faq-5.8

--
Lionel B
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem mixing read and write on io fstream Sachin Garg answers 1 August 22nd, 2008 05:05 PM
Is VB.NET Stable?? Tony Van answers 214 December 11th, 2006 08:25 PM
Fastest way to search text file for string Julie answers 60 November 16th, 2005 12:21 PM
Reading text into varchar Hayat answers 1 July 20th, 2005 02:41 AM