It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I have a project (sort of) where I have to write a C program to take in user inputs and store it into a MySQL database for future retrieval.
Now, I have written the program for console mode.
I.e. it asks the user please enter a name and then the name entered by the user is stored in 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
If it is ran in the console, it is not GUI programming. If you are emulating GUI programming in the console (with text boxes, etc), it is call TUI (Text User Interface) programming.
On Unix/Linux systems one typically uses the new curses (aka "ncurses") library. On Microsoft systems, I believe the PDCurses library is the closest thing available. Using them you can set up "text" windows which have height and width measured in characters (including text input fields).
If you don't need to simulate a window system in text, then just read and write lines to stdout and stdin.
Related
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
How to develop a GUI for my program.I have made a c program to encrypt and decrypt any secret text message. I am hiding the message in the spaces between the words.
There are some GUI frameworks for C.
GTK is one of the most used when porting Linux applications
IUP is very lightweight
other listed on Google
However, my preferred solution to to add a rich GUI to C programs in a quick way, is to use Tcl/Tk. You can separate completely your application from the interface, test the C code at your leisure using the command line and concentrate on the GUI as a separate effort.
There are two possible approaches for mixing Tcl/Tk and C:
Create an executable and call it from the Tcl/Tk GUI with [exec ... ]
Create a DLL and call the functions as tcl commands
The first approach is extremely easy but might be unsatisfactory from an esthetic point of view.
The second approach is a little bit more complex and has two variants: create a real tcl module or use [ffidl][4] to call the dll directly. This time, the second is simpler than the former.
Finally, if you need to have a single, self-contained executable you can rely on tclkit which will embed everything you need in a single executable.
P.S. I see from one of you comments that your on Windows. You can create Windows GUI directly in C (here is an old tutorial) but I can ensure you it's a real pain! If you want something more modern you have to switch to C++
To develop your GUI, you could use GTK: https://developer.gnome.org/gtk-tutorial/2.90/ .
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
This is a general question, and one that I have yet to find a good solution.
First, some pretext. I'm new to programming and all I have done (mainly anyway) are sequential programs in C.
This leads me to wonder how do big programs such as word, photoshop,visual studio etc. work.
To be less vauge, how do they remain open for one? All the programs I have written are top to bottom, the code runs and then the program terminates. Also What always user to say click save and the file writes or to click font and change the font. Clearly these operations can be performed in any order, infintely many times.
In general I do not see from my limited experiecne how real world applications are made. I want to try and make something "real" or useful, but school has not yet begun to teach me where to start.
Most desktop applications are programmed using a style called event-driven programming. In this setup, the program usually looks (at a very high level) like this:
while (true) {
wait for an event to occur.
react to that event.
}
These "events" tend to be things like mouse clicks, keyboard events, window resizings, etc. Typically, event-driven programs set up windows and attach pieces of code to them so that when an event occurs, the given piece of code can run. Each piece of code that's attached tends to look exactly like what you've seen - it executes from the top to the bottom in a normal fashion. The fact that different events can happen in different orders just means that they run when the user asks them to.
Every language and framework has their own way of handling events, so I'd recommend consulting the documentation for your favorite language / system for more details.
Hope this helps!
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have a project I'm going to be doing on a microcontroller. I plan on having it interface with my computer over a USB serial connection. I tried doing the basic tests like putc(getc()), but I'm having trouble getting it to behave as I expect.
With that simple hardware-echo thing, many things just don't work. When I push enter, I just get a carriage return. Backspace does nothing. CTRL-C for breaking doesn't work either.
I'm using GNU Screen as my terminal emulator. How do I learn how to handle all of this(along with stty settings) so I can make a useful command interface on my microcontroller?
You will need to know what terminal type your Screen terminal is emulating so that you know what codes to send out the serial port. For example, if you set your terminal to VT100, you can check out this link which provides some VT100 codes
And for gnu-screen you might want to check this out as it contains an exhaustive list of ESC and control strings/commands that you can use.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have begun writing (in C) a small client/server application which relies on TCP. I lack any experience in network programming. I'm sorry for the open-ended character of this post.
I'm wondering how best to encode and decode messages. I've chosen the following approach:
The client sends commands to the server. Every command has a number assigned to it and a struct. The struct stores the command's arguments and the way the arguments are laid out in memory (and in the stream as well). When the client wants to send a command, it fills the respective struct with data. In order for the server to recognize the command, the client sends one byte which contains the command number. Right after the command number byte, the message itself is fed to the stream (with its fields properly converted to network byte order).
This approach led to working code, but it entails a lot of redundancy (I find myself writing switch statements over and over). Is there a better way? What's the standard procedure?
Google's Protocol Buffers are a nice way to serialize/deserialize data. There are implementations for C.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I've just recently begun programming in C. I currently have an application that read's in values from a COM port and write them to a file. It reads about 500 data points per second. I want to be able to compute a real-time 2D plot of the data points with respect to time. Can someone please point me in the right direction?
I've tried to post-process the data in Excel and the built in capabilities allow me to get a great graph. However, I would just like something that is computed in real-time rather than post processing it. I am using Windows XP.
Thanks in advance !
You can use KST to plot your graphs in real time. You can probably keep your existing application as is (I assume you are writing to a CSV file if you are reading it in Excel) as KST will read the data from the file as it gets updated, and update its chart.
Here are some options for you to explore:
You can use OpenGL and in particular, GLUt. I have some C code for
this if you are interested.
You can pipe commands to gnuplot.
You can use GNU Octave from a C/C++ program. You can read more about
this here.
You can create your own bitmaps in real-time of you graphs. This isn't as hard as it sounds.