Updating file random access


I have even tried a single record without any while loop or if statement and it still does not work. loop: fread( &client, sizeof( struct client Data ), 1, cf Ptr); while (! = 0 ) { client.balance -= service Charge; fseek(cf Ptr, (-1 * sizeof(struct client Data)), SEEK_CUR); fwrite( &client, sizeof( struct client Data ), 1, cf Ptr); } fread( &client, sizeof( struct client Data ), 1, cf Ptr); } In case the plethora of differently-named file variables indicates that some version of your code tried to open the same file multiple times, reading from one version and writing to another: don't do that, and if you really must do it then flush the file between writing to it and trying to read from it.while(fread(&client, sizeof(struct client Data), 1, file Ptr)) { if (Num) { client.balance -= charge; fseek(file Ptr, - sizeof(struct client Data), SEEK_CUR); if (1 !To access a file randomly, you open the file, seek a particular location, and read from or write to that file.



Copyright © 1993, 2016, Oracle and/or its affiliates.

permit nonsequential, or random, access to a file's contents.



  1. Pingback:

  2. eric   •  

  3. eric   •  

    Also, what type of incentives will the users get in return?

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>