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

Suggestions Please - Use Array?

Status
Not open for further replies.

jamescpp

IS-IT--Management
Aug 29, 2001
70
US
I have an application that I need to make some enhancements to. As background, the program is used for LDAP authentication for another system. Problem is the other system does a lot of authentications even if you're already logged in once. I'd like to cache logins so subsequent logings are checked there first. Assuming they're within a timeout period the authentication doesn't have to go all the way out to LDAP. (other reasons too)

Someone suggested I use a multidimensional array to store the username, password, and login time. Then compare the current request etc. I would need to be able to easily add, remove, and compare entries from the array(the cache). Also, it's unknown how big the array would be, so it would need to be able to grow.

In Java I would use a Vector, but in c I'm not sure. Can anyone help? Can you point me to a good reference? If it's a multidimensional array of some type can you give me an example of it's creation, adding to it, deleting from it, and comparing?

Thanks,
James
 
Using 2D array for ur case will not be better one because you will not know the size of the array and you want to do adding & removing of elements. So its better to use linked lists. For your case the single linked list is enough.

you can use the following structure for the single linked list

struct Info
{
char username[15];
char password[50];
loing login_time;
struct Info *next;
};

Do u want the total linked linst program ?.

Maniraja S
 
Maniraja S,

If you have something I wouldn't mind the whole program. By chance does it sort the linked list? I figure for performance I will need to either sort the list, or make sure entries are added/removed in sorted order, probably by user. It will have a lot of entries, as much as a couple thousand.

Thanks a lot.
James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top