Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

problem in file handling

hi dears
i am working with file handling.
i have used fstream object and it read and write method.
there is a problem e.g

syntex:

fstream file;
file.open("data.txt",ios::binary|ios::out|ios::in)
file.read(parameter list)
file.write(parameter list)


i saved 28 records in the file and closed the program.again i run and save the data at the location of 14th record .Now when i see the file all records from 15th to 28th are removed.can any body help me in this regard.

Comments

  • denciodencio Member Posts: 8
    : hi dears
    : i am working with file handling.
    : i have used fstream object and it read and write method.
    : there is a problem e.g
    :
    : syntex:
    :
    : fstream file;
    : file.open("data.txt",ios::binary|ios::out|ios::in)
    : file.read(parameter list)
    : file.write(parameter list)
    :
    :
    : i saved 28 records in the file and closed the program.again i run and save the data at the location of 14th record .Now when i see the file all records from 15th to 28th are removed.can any body help me in this regard.
    :
    >> try string concatenate, or buffer it inside the program.. edit it ans wrie it to file in one huge chunk
  • Chris BrownChris Brown USAMember Posts: 4,624 ✭✭

    _ \ http://forcoder.org \ free video tutorials and ebooks about { Java, R, PHP, Swift, C++, Go, Ruby, Delphi, Perl, Assembly, MATLAB, Scratch, Python, Objective-C, PL/SQL, JavaScript, C, Visual Basic, C#, Visual Basic .NET Lua, F#, Kotlin, Scheme, Bash, Dart, Logo, Clojure, COBOL, SAS, Ada, Erlang, Fortran, Hack, Prolog, D, VBScript, ML, LabVIEW, Lisp, ABAP, Crystal, Julia, FoxPro, Awk, Alice, Apex, Rust, Transact-SQL, Scala } ________

Sign In or Register to comment.