This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can someone please tell me how to store a table using file handling only

 
Aayush Goel
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone please tell me how to store a table using file handling only
 
Steve Luke
Bartender
Posts: 4181
21
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Aayush,

Welcome to the CodeRanch!

I would love to help you with your problem, but I am not really sure what you are asking. Can you be more specific? For example what exactly is a 'table' and what do you mean by 'store' it?
 
Aayush Goel
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The table is a simple data table like a product's name , its weight, colour etc like in a data base and i would like to 'store ' it in a simple .dat file on the hard disk.
 
Campbell Ritchie
Sheriff
Posts: 48642
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You would have to create a format for it, and write that format to the file. Try to avoid the .dat extension, otherwise Windows will think it is a system file.
You might write
Vacuum Cleaner|3.2kg|Red|Can be used as secret weapon
. . . or something similar in each line. The "secret weapon" bit is of course only applicable to Graham Greene fans
 
Aayush Goel
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, that exactly hit the mark.
 
Campbell Ritchie
Sheriff
Posts: 48642
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome
 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you use a | to split you data make sure that the input doesn't contain that character.
 
Rob Spoor
Sheriff
Pie
Posts: 20510
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And when using | to split, remember that it's a meta character in regular expressions.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic