What is the best way to assign values to variables of various data types from reading a file (while importing as few things as possible and making use of the simplest code)? I need to write a program which can assign values from a .dat file, if that's relevant. If you could also provide some examples and explanations of such, you will be mentally extolled. Thanks.
McCurry0x77
0
Newbie Poster
Recommended Answers
Jump to PostI suppose you have already figured out how to write to a file, or you plan to manually make the file. The way I would go about doing this is using a BufferedReader.
Here is some code:
BufferedReader in=new BufferedReader(new FileReader("C:\\users\\sample.dat")); //creates BufferedReader to get value …
Jump to PostWhat is the ".dat" file? That extension doesn't really mean anything and many programs store many different types of things using that extension in many different formats. If know what is saved, and, more importantly, how it is saved, we could give you a better answer. P.S. A BufferedReader will …
All 8 Replies
btsuper
0
Newbie Poster
masijade
1,351
Industrious Poster
Team Colleague
Featured Poster
McCurry0x77
0
Newbie Poster
masijade
1,351
Industrious Poster
Team Colleague
Featured Poster
btsuper
0
Newbie Poster
masijade
1,351
Industrious Poster
Team Colleague
Featured Poster
Dannyo329
10
Junior Poster in Training
masijade
1,351
Industrious Poster
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.