Computing.Net > Forums > Programming > How to create & save Database in C

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

How to create & save Database in C

Reply to Message Icon

Name: Miroslav
Date: May 8, 2004 at 14:50:40 Pacific
OS: Windows XP
CPU/Ram: AMD Athlon
Comment:

I'm a beginner and I would like to know how to create a program that use (and save) a database. Can you please give me a simple example in C language for store name, address and phone numbers ?

Thank you very much for your attention and help.

Miroslav.




Sponsored Link
Ads by Google

Response Number 1
Name: Hoang Tran
Date: May 9, 2004 at 03:13:44 Pacific
Reply:

If you want to open an existing database on your own then you're talking about reinventing the database engine, which is a fairly large job. First, you'll have to find out how the target database is structured, ie. the table's definition (data type, size in bytes), then you'll need to find out how the database's file is structured, ie. where is the header, what're in the header, where the data start etc ... When you write the data back to the database file, what field in the header do you need to update etc..

Other than that, records in database are just a lumps of bytes and you can use struct to read and write from/to a file. The difficult bit is the organization of the database to allow quick access to any record at any location on the data file using keys.

The bestway is to get the database's API and use the ready written code to access the files.


0

Response Number 2
Name: Miroslav
Date: May 10, 2004 at 18:06:58 Pacific
Reply:

Where can I found this database's API ?

Thanks again...


0

Response Number 3
Name: Hoang Tran
Date: May 11, 2004 at 01:47:16 Pacific
Reply:

Search on the net for the website of the company or person who wrote the database, see if any exists. Often companies who wrote the database engines for people to use also made the API available for developers. You'll probably need to purchase it from them.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: How to create & save Database in C

how to creat a NEW .dat file in C? www.computing.net/answers/programming/how-to-creat-a-new-dat-file-in-c/4558.html

how to create a modeless dialog in VC++ www.computing.net/answers/programming/how-to-create-a-modeless-dialog-in-vc/2994.html

How to use string array in C++? www.computing.net/answers/programming/how-to-use-string-array-in-c/9478.html