Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Binary Files ?

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, i need some ideas with Binary Files..
I have an assignment to do based on binary files..
basically, A binary file stores customer id, name and current balance in ascending order of customer id. A program accepts transactions from a user to update customer records. Later enters customer id, program reads file for a record matching with the customer id. entered. Then it asks for type of transaction - p(payment), s(sales). It asks for the amount from current balance.
Updated record is then written to a new file. Program continues until end of the file, and then displays each record from the new file. All transactions are entered in the order of customer id.
And the assignment only asks us to create 5 records, and the user enters three transactions, two for payment type and one for sales type.
i have some ideas on what input and output files to use. like FileOutputStream and FileInputStream.
But, how to update the file i dont know..
kind regards
Atif
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Atif,
I think you should not use FileOutputStream and FileInputStream. The easy way to do this is that use fix-size record, and then use the RandomAccessFile the to access records.
 
atif abbas
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, for your tips..
one other thing how can i update records once io have stored records. Like if i want to add other records, and how will i be able to match the records based on the customer id..
kind regards
Atif
 
atif abbas
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here is my code so far..please i need help with the updating of current-balance ..thanks
kind regards
Atif.
 
Forget Steve. Look at this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic