"junaid" <ju*********@yahoo.com> wrote
Can it is possible to connect to the databse like postgre or mysql
through a C programm?
Normally by calling library functions supplied by the databse vendor, or
maybe third parties, just as you would any other function.
I know the basics of C and I have developed a small program which uses
a file for the repositary of the data.But I want to use a database for
this, insted of file.
If possible please give some Code snippets for the connectivity as well
as how to run the queries.
Unfortunately we don't discuss non-ANSI libraries on this ng. However we do
discuss how to use such libraries in a general way.
This would be typical code.
#include <stdio.h>
#include <library_specific_header>
void yourfunction()
{
THEIRTYPE x;
int result;
x = theirfunction("a string parameter");
result = theirotherfunction(x);
printf("Their library gave me this result %d\n", result)'
}
When you compile, some compilers will ask you to link the library, which may
involve knowing where it is physically kept and what the filename is. Others
will do this automatically.