How to save data in C / C ++?

There are databases on the Internet (mysql, oracle, etc.) where I can send the information represented by the HTML input fields using PHP or any other server-side language.

How does it work in C / C ++? How can I let the user enter something and they save the entered value?

+4
source share
6 answers

You can:

By the way, they are common to all languages.

+4
source

It really depends on what you want to keep.

There are libraries (like this one) that allow you to connect to SQL databases from C ++.

Another approach would be to save / load it to a file. For simple things, filestreams can be good enough, in other cases you might need something tougher, like boost :: serialization , to get the hard work out of it.

+3
source

Why do you think C / C ++ is different from other languages ​​(like PHP) in terms of data storage? You can save your data:

  • in the database (you must open a connection to the database)
  • in a tiny database like SQLite
  • in file

You can choose the desired method.

+3
source

Are you talking about a desktop (stand-alone) application or some kind of web application? And it depends on what information you are going to store. Perhaps the Windows registry will be enough.

You can also use MySQL to store data. There are many tutorials on working with MySQL through C ++. Here's a handy api .

And you should read this .

+3
source

For the user to enter something outside the command line, you need a GUI toolkit. To communicate with databases, you need an infrastructure such as MySQL Connector / C ++.

+2
source

see also the following: libodbC ++ - C ++ is a wrapper for ODBC, much more convenient than simple C ODBC.

if you are running Linux, you can find useful information here: UnixODBC is the popular ODBC infrastructure for Linux.

+2
source

All Articles