Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to read a 2-D table from a file

Status
Not open for further replies.

RubyL

Programmer
Apr 28, 2001
14
0
0
US
I am using Borland 5.0 and trying to open a file and read the table a row at a time.
 
Are you having trouble with opening the file or with reading the data?

What's the format of the table you want to read?
 
The table is int weight[10][5] it is a table of a series of
different sets of: 10101 I was trying to read with fscan I beieve the file opens as it passes my error check to open the file. I'm getting something out of it, but it is not correct. For each 0 I want to print a ":" and for each 1 a "|" per column. I need to be able to tell the program what row I want it to read. I can find information on char but I'm not finding anything on reading tables that contain numbers. Any help would be appreciated. I'm not that faniliar with C++.
 
I don't understand your problem, exactly.

You have some sort of data file you want to read a table from. First of all, again, what format is this data file in? Is it text? It sounds short. Just post an example of what the file would look like.

You say something about an array and about printing ":" and "|". Those sound like two different problems. Do you mean you want to store these characters in the array? Do you want to store the values you read in the array and then print the corresponding characters out? In that case, do you actually need the intermediate array, or can you just read the file and print the output directly?

Be a bit clearer about what you're trying to accomplish. Post a sample data file and describe the result you'd expect from it. It also might help to know sorta what you're trying to do.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top