reading and writting data problem

M

MJK

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
 
O

osmium

MJK said:
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.
 
L

Lionel B

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-lite/how-to-post.html#faq-5.8
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top