the problem is.. a certain .dat file consists of 3 fields of data..for example...user account, password and username (gibsonML, sweetie33, Mel Gibson). How I will load it and then assign it to hash table. Thanks..

Recommended Answers

All 4 Replies

> How I will load it and then assign it to hash table
So is this about reading files, or hash tables?

the problem is.. a certain .dat file consists of 3 fields of data..for example...user account, password and username (gibsonML, sweetie33, Mel Gibson). How I will load it and then assign it to hash table. Thanks..

both...from a .dat file the content of it will be placed on the hash table..i am just confused how i will start the problem..

> How I will load it and then assign it to hash table
So is this about reading files, or hash tables?

both...from a .dat file the content of it will be placed on the hash table..i am just confused how i will start the problem..

fopen() to open a file, fclose() to close it when you're done.
fgets() to read each line from the file
sscanf() to extract information from the line

The first step is to show you can read the file reliably, Say by printing out
user account = gibsonML
password = ...
etc

for each valid record in the file.

Then we can talk about step 2

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.