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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I read data into table format that can be queried?

Status
Not open for further replies.

hdhusker

Programmer
Jan 8, 2008
1
0
0
US
File: inFile

E EntityNameA1 EntityNameB1
C ColumnNameA1 ColumnNameB1
C ColumnNameA2 ColumnNameB2
C ColumnNameA3 ColumnNameB3
K ColumnNameA1 ColumnNameB1
K ColumnNameA2 ColumnNameB2
E EntityNameA2 EntityNameB2
C ColumnNameA1 ColumnNameB1
C ColumnNameA2 ColumnNameB2
K ColumnNameA1 ColumnNameB1
E EntityNameA3 EntityNameB3
C
C
C
C
C
K
K
K
E
.
.
Note: E=EntityName, C=ColumnName, K=Columnname *Key


What program needs to do:

Run on UNIX SUN Blade 1500
C++ language
No database connection

Need to read inFile and store the data in a table format (in memory) that can be queried. The search criteria should accept the valuse in EntityNameA# (E), ColumnNameA# (C), and ColumnNameA# (K) as input but then return the corresponding values in EntityNameB# (E), ColumnNameB# (C), and ColumnNameB# (K) as output.

For example:
EntityNameA#(E):
ColumnNameA#(C):
ColumnNameA#(K):
[Search Criteria]

EntityNameB#(E):
ColumnNameB#(C):
ColumnNameB#(K):
[Return values]

Note: This is not homework but work related. Someone told me I could use a DoublelinkedList to accomplish this but I do not understand how to setup a DoublelinkedList.

I would appreciate it, if anyone can help show how I could code this up.

hdhusker
 
std::list is a doubly linked list. Stick the data into a class with the == operator defined. This will compare each of the fields. Then use std::find to look for it.

Try it first with one field. When you get the structure correct, add the other fields.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top