Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to save data in C/C++? [closed]

Tags:

c++

c

database

save

In the internet there are databases(mysql, oracle etc.) where I can send the informations submitted by the HTML input fields with PHP or any other server side language.

How is this working in C/C++? How can I let a user input something and them save the inputted value?

like image 655
Adam Halasz Avatar asked Dec 03 '22 10:12

Adam Halasz


2 Answers

You can either:

  1. Make use of the standard file handling functions/classes.
  2. Embed a tiny database.
  3. Talk to a database server using a standard interface.

BTW, these are common for all languages.

like image 87
Vijay Mathew Avatar answered Dec 11 '22 08:12

Vijay Mathew


Really depends what you want to save.

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

Another approach would be to save/load it to a file. For simple things just filestreams may be good enough, other times you may want something a bit more hard-wearing like boost::serialization to take some of the hard work out of it.

like image 34
TZHX Avatar answered Dec 11 '22 09:12

TZHX