the problem at the 1st program is that the read() function doesn't store the data in the variable.
and the same is at the 2nd program, it's like the read() function isn't even used :/
it does nothing!
Xai:
oh, i thought i uploaded the previous verstion, which was where i used the read() function.
well, since that didn't work i tried get(), but still the problem occurs.
the only difference at the output is that the variable 'st' has the value -256 when i used get(), and when i used read() it has -1.
the value of tellg() is 0 at first and from there on -1.
don't know if this helps, but i'm trying to convert this pascal program to c++:
program files;uses crt;var f :file of integer; i,sv,nv,faktor:integer;begin ClrScr; Assign(f,'a:\st.dat'); Reset(f); Write('Enter factor : '); ReadLn(faktor); For i:=0 To FileSize(f)-1 Do Begin Seek(f,i); Read(f,sv); WriteLn('Old value : ',sv); nv:=sv*faktor; Seek(f,i); Write(f,nv); WriteLn('New value : ',nv); End; Close(f); ReadLn;End.