The problem that I have is that I have two enums in two different files which should have the same sets of constants (two different processes are generated by the two files along with other files). I want the enums to be in sync i.e. when some one adds a new value to enum x and forgets to update the other enum, I want to throw a compilat...
I don't know how to explain this very well, but here's a shot at it. Don't hesitate to ask for clarification, please.
Suppose I have a console that displays numbers that change with certain events. The best example would be a "plane" instrument that shows altitude, direction, wind, etc. Like so:
Altitude: 9876ft Direction: NE
Wind...
Hello there,
I'm confused when trying to fetch table rows in mysql using C++ with MySQL C API.
I can do it easily in PHP, just because C++ is a strongly-typed language so that we also need to take care of the dirty process..
This is how I done it in PHP
$data = array();
$i = 0;
$query = mysql_query("SELECT * FROM `my_table`");
while(...
that is how I build it: gcc pkg-config --cflags --libs gtk+-2.0 -o spawn spawn_with_pipes.c
In the snippet of example below, I get an error: syntax error before "Data - it refers to data= g_slice_new(Data);
#include <gtk/gtk.h>
typedef struct
{
/* Buffers that will display output */
GtkTextBuffer *out;
GtkTextBuffer *err...
Coming from a C and C++ background, I found judicious use of typedef to be incredibly helpful. Do you know of a way to achieve similar functionality in Java, whether that be a Java mechanism, pattern, or some other effective way you have used?
Thanks,
-bn
...
I've been hacking on a program that itself creates simulation programs in C. The user specifies the top-level design, and this programs inserts small C-fragments and a helluvalot glue-code (a few thousand lines).
It does local naming by #defines:
#define x local_x
#define vx local_vx
/* user code that uses x, ex */
vx = x / 2
#undef vx...
I wish to develop a custom network layer protocol. I suppose it can be done using C. Can any one suggest how to begin with. Any references or sample code would be of great help.
...
I'm trying to write a program that takes input of - hexadecimals, octals, and decimals -, stores them in integer variables, and outputs them along with their conversion to decimal form. For example:
User inputs: 0x43, 0123, 65
Program outputs:
0x43 hexadecimal converts to 67 decimal
0123 octal converts to 83 decimal
65 decimal convert...
I'm using gtk on windows and I need an ability to create a pipe for communication between processes via g_io_channel_win32_new_fd. How do you do that on windows?
...
Is there a way to check whether the current user can write to the registry? More specifically if it's not an administrator, can it write to HKEY_LOCAL_MACHINE or the policy keys on HKEY_CURRENT_USER.
I tried with LookupPrivilegeValue() but I don't think it's the right thing to do.
Code is appreciated.
...
I could use getpass() to get a password. However, the man page says:
This function is obsolete. Do not use
it.
What is the current way to get a password from the user's terminal without echoing it, in a POSIX-compliant way? [Originally I said "portably", but my intention was to avoid using an obsolete function.]
...
I am pulling information from a binary file in C and one of my strings is coming out as \\b\\3777\\375\\v\\177 in GDB. I want to be able to parse this sort of useless data out of my output in a non-specific way - I.e anything that doesn't start with a number/character should be kicked out. How can this be achieved?
The data is being buf...
Hi,
Im getting into kernel work for a bit of my summer research. We are looking to make modifications to the TCP, in specific RTT calculations. What I would like to do is replace the resolution of one of the functions in tcp_input.c to a function provided by a dynamically loaded kernel module. I think this would improve the pace at w...
I cannot get GTkStatusIcon working in Windows and I get no errors. And I make a call to both gtk_status_icon_set_from_file and gtk_status_icon_new_from_file. Does anyone have any idea what could be causing this? I tried with .ico files and .png and still nothing...
...
In linux, is there a built-in C library function for getting the CPU load of the machine? Presumably I could write my own function for opening and parsing a file in /proc, but it seems like there ought to be a better way.
Doesn't need to be portable
Must not require any libraries beyond a base RHEL4 installation.
...
Hi,
I wanted to know how linker resolves the printf symbol in the following assembly code.
#include<stdio.h>
void main()
{
printf("Hello ");
}
.file "test.c"
.def ___main; .scl 2; .type 32; .endef
.section .rdata,"dr"
LC0:
.ascii "Hello \0"
.text
.globl _main
.def _main; .scl 2; .type 32; .endef
_main:
...
I'm linking a C++ source with a C source and a C++ source. I create a thread with pthread, a cancellation point and then I call pthread_exit either through the C or the C++ source file.
If the pthread_exit call comes from the C source, the cancellation handler does not fire! What may be the reason for this?
b.cc:
#include <cstdio>
#in...
Hi
Consider the following simple code fragement:
void SetCommand( const unsigned char *cmd )
{
iHeader[4] = *cmd;
}
...
const unsigned char *test = "\x72";
unsigned char iHeader[32];
hdrSetCommand(test);
What I wanna do is pretty straighforward: I have a 32 character array and the SetCommand should set me the 4th byte ...
Hi All,
I am looking a Tool on How to Find CPU Utilization of a Single Thread within a Process in VC++.
It would be great full if any one could provide me a tool.
Also it could be better if you guys provide how to do programmatically.
Thank you in Advance.
...
Hi,
I am trying to teach myself C Programming and I am using DevC++ for my IDE under Windows XP. I am a little confused on the correct way to call my own Header Files.
I have my main source file called main.c and a separate file for functions called myFunctions.c which I include in main.c using 'include "myFunctions.h" with all my func...