Re: File writing Problem



I have 4 operations which are to done on two numbers let's say
addition,sbtraction, division and multiplication.The output resulted
due to these operation should be stored in a text file one after the
other. When I execute the program first time it's writing the output
onto the file. When I reexecute the program once again it's appending
to the file but not discarding the previous content.This happens when
I use a+ option. When i use the w+ option it's discarding the
previous content but it's writng only the fourth operation and
leaving the rest three.

I am struck and I don't know how to proceed.

Thxs
Vamsi

Jérôme wrote:
>
>
> What's about this one :
>
> 'w+' Open file, or create new file, for reading and writing;
> discard
> existing contents, if any.
>
> Jérôme
.