Yes, you can access a database in a C program but database access as such isn't defined by the C language. To access and perform operations on a database such as Oracle, MySQL, MS Access etc., you would typically use an API (application programming interface) provided by the vendor of the database which consists of functions that perform operations on the database (connect, query, update etc). In other words, how to do what you want depends on what database you want to use. Visit the vendor's web site and you should find lots of documentation on how to do this. If you've decided on a database, you can also post again with this info and someone here can probably give you help.
There are also "flat file" databases which are simply files composed of lines that represent the "records" each of which is composed of delimiters that divide the line into "fields." A flat file database that stores data for an address book might look something like this:
You can use the file functions prototyped in <stdio.h> to manipulate a database such as this. This is only a feasible solution though for toy programs or small data sets or where speed isn't a concern.
I'm not sure I understand the distinction you're making between "pure c code compiled in vc++" and "vc++ code accessing a database" since vc++ is an ide that includes both a c and a c++ compiler.
If you're asking if you can combine c and c++ code, you can, given that you compile your program as a c++ program and make any necessary changes to your c program to make it legal c++.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.