Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
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
 
Bartender
Posts: 4181
22
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.
 
Marshal
Posts: 59092
180
  • 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
Marshal
Posts: 59092
180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome
 
Bartender
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.
 
Sheriff
Posts: 21328
87
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.
 
If I'd had more time, I would have written a shorter letter. -T.S. Eliot such a short, tiny ad:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!