gui through c

i have a project(sort of) where i have to write a c programto take in user inputs and store it into a mysql database for future retreival.

now, i have written the program for console mode.

ie it asks the user
please enter a name
and then the name entered by the user is stored on the database.

but, i have to do it in this way , like when the screen comes it will show

name
|--------|
|--------|<- here the user will enter his name.
|--------|


and, from here the name entered will be stored in a string variable.

i am not sure , but i think it is gui programming.

i have no knowledge about gui programming.

unfortunately, i don't have much time to read a lot.

so. can you please point me to some tutorial or some resources or anything that is specifically aimed at this type of gui programming.

i want to use the win32 api

please help!
I don't think you need a Graphical User Interface. It is also possible with a simple console. For example, you ask for the information to be stored in the database line by line, then just save it.

It would be like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <iostream>
#include <mysql.h>
   using namespace std;
   MYSQL *connection, mysql;
   MYSQL_RES *result;
   MYSQL_ROW row;
   int query_state;
   string name;
   int main() {
       cout << "Enter your name";
       cin name;
       mysql_init(&mysql);
       connection = mysql_real_connect(&mysql,"localhost","username","password","database",0,0,0);
       if (connection == NULL) {
           cout << mysql_error(&mysql) << endl;
           return 1;
       }
       query_state = mysql_query(connection, "insert into users(name) values ('" + name + "')");
       if (query_state !=0) {
           cout << mysql_error(connection) << endl;
           return 1;
       }
       cout << "Name added successfully to the database!";
       mysql_free_result(result);
       mysql_close(connection);
       return 0;
   }


P.S.
I don't know if this is the correct way of joining these strings "insert into users(name) values ('" + name + "')".

Anyway, a good Win32 API tutorial for beginners can be found here: http://www.winprog.org/tutorial/
You must create an EDIT control (inside of which the name must be inserted) and a button. When the button is clicked the information is sent to the database by the same way as the console one.
Last edited on
Topic archived. No new replies allowed.