tags:

views:

584

answers:

3

Hi,
When I write to the beginning of the file,it always leaves the first line empty,and start writing from the second one.
How can I make it write from the first line,including the first one and on?
Thanks.

+2  A: 

If I understand your question correctly, you are creating a new file or overwriting an existing file and afterwards the file starts with a blank line that you do not want? If so, you are probably printing out a newline ("\n" or endl) at the beginning without realizing it.

Glomek
A: 

Sounds like you are outputting a newline character before the first line . Can you post some code that has the problem?

tvanfosson
A: 

Also, make sure that, if the file is not a new file, that you are not opening the file in 'append' mode.

michalmocny