Combination of Database and C programming
How can I combine the C programming and database, provided that my program requires random choice of data?
How can I combine the C programming and database, provided that my program requires random choice of data?
The question is not clear as it does not inform as to what sort of database you need from C. If you are looking for some standard database like MS Access or Oracle, then you need to know their database formats. But this is tedious job as you will face a lot of hardships in order to find the formats for the database to use.
In order that you merely need to create a database of your own, you may create a structure containing a number of variables and use it for writing, reading, appending or manipulate a text file. You may want writing it in binary mode too.
use fprintf() function fowriting to a file using a FILE pointer,
use fwrite() function to write in binary mode.
Read using fscanf() function if you have written using fprintf() and
Read using fread() if you have written in binary.
Use fseek() to get the FILE pointer to any position in file and manipulate data.
fread() reduces the size of the file than fprintf().
Thanks.
If you are new to C programming and I think you are interested in learning it much further, here is a website that will help you understand major terminologies, functions, commands, techniques, Java tutorial, game and graphics programming, and others. The author of the site recommends users who are really new to C++ to purchase the eBook “Jumping into C++”. For your free online tutorial on C programming and or to purchase the eBook as well, you may visit Your resource for C and C++.
The site offers tutorial on OpenGL, C, STL, and C++. The free tutorial offered is designed for beginners and contains lots of examples for you to better understand it including tips and explanations that come with it. Here are some of the available C++ tutorials: