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

c to c++..

Status
Not open for further replies.

leela74

Programmer
May 11, 2001
26
IN
Hi,

Is it possible to access database through c program. If yes how?

Or otherwise if I use the vc++ compiler...

Can I join two programs one is pure c code copiled in vc++ and the other is vc++ code accessing database....

Thanks in advance

Sridhar
 
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:

john:doe:555-555-5555
mary:goe:666-666-6666
blar:blo:777-777-7777

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 &quot;pure c code compiled in vc++&quot; and &quot;vc++ code accessing a database&quot; 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++.

Russ
bobbitts@hotmail.com
 
Hi Sridhar,
rbobbitt left nothing for me to say. If u r talking about accessing oracle database u may use ProC.


HTH,
SwapSawe. s-)
 
The best API you can use in C under Windows is ODBC. John Fill
1c.bmp


ivfmd@mail.md
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top