I have noticed that a large number of C compilers issue warnings when the conversion specifiers in the format string of the printf/sprintf functions do not match the type or the count of the corresponding arguments.
That seems to me like a conceptual break since C doesn't have built-in functions according to the language specification.
...
I am working on trying to pass data from one ANSI C program to another through RPC. The data that I need to send is currently being stored in a struct as an 'int **m' (a matrix). When I try to write out the IDL file and compile it with 'rpcgen -C -Sc myfile.x' using the following structure:
struct thread_data {
int size;
...
I am working in a project using openframeworks and I've been having some problems lately when writing XMLs. I've traced down the problem to a sprintf:
It seems that under certain conditions an sprintf call may write commas instead of dots on float numbers (e.g. "2,56" instead of "2.56"). In my locale the floating numbers are represented...
Hi, I am writing a program using gtk. What the program does is monitor the keystroke the user entered and play a sound. My question is that how do I catch the key-press-event when the window is not focused? I'm planning to let my program stay in tray icon, so I wonder how I can grab any key-press-event from there. Thanks
Edit:
I finally...
I'm working on a batch system (Torque), now the important part is this: When an interactive job is run, the submit tool will communicate with the execution host. This fails on one of the machines.
Here is the strace output:
Sumbit tool:
16:18:36.219925 fcntl(4, F_GETFL) = 0x2 (flags O_RDWR) ...
I have a problem trying to use autotools for a simple contrived project, the task is simple, use Objective-C on Mac OSX, and C++ on Windows (mingw) - with some C glue in the middle.
The project is structured like so (minus all the automatically generated files):
./aclocal.m4
./configure
./configure.ac
./Makefile.am
...
Is there interfaces dependency graph for IWebBrowser2 component?
I just want to make it clear what kind of dependencies exist between interfaces and who calls who?
...
Hi,
Can anyone tell me the difference between int main() and int main(void). Why both of them work and what is the default argument to int main().
...
What I am asking about is the well known "last member of a struct has variable length" trick. It goes something like this:
struct T {
int len;
char s[1];
};
struct T *p = malloc(sizeof(struct T) + 100);
p->len = 100;
strcpy(p->s, "hello world");
Because of the way that the struct is laid out in memory, we are able to overlay ...
I am writing a dynamically growing string buffer. I have the following in a .c file.
#ifndef STRBUF_GROWTH_SIZE
#define STRBUF_GROWTH_SIZE 4096
#endif
My code uses this constant to do the reallocation of the buffer. Now in the tests, I need to set this value to a small one so that I can check the reallocation. I tried defining this in...
Assuming the following code, i have strange error in my base64 encodings.
#include <openssl/bio.h>
#include <openssl/buffer.h>
#include <stdio.h>
#include <string.h>
char * base64(unsigned char * input, int length) {
BIO *b64 = NULL;
BIO * bmem = NULL;
BUF_MEM *bptr = NULL;
char * output = NULL;
b64 = BIO_new((BIO...
I'm trying to write a chat server in C that allows communication between two clients using POSIX sockets. I'm not sure I have a good grasp on this concept or how I should set up the communication protocol between the clients and the server.
I know I need one socket to bind() the server port to so I can accept incoming connections from c...
Is there a way to timeout a reading from stdin in order for the program not to hang for too long ?
read(0, var, numberofbytes);
...
Hi all, so I'm having a crazy time right now reading characters off a stack. I'm storing the char as an int, so I can check for the EOF signal, but things aren't going so well. I'm new to the implementation of stacks, so things are probably just wrong somewhere. Here's my code.
I'm getting both the incorrect top character on the stack (...
What library is used to make a static terminal window like vim, nano, irssi or aptitude as opposed to a scrolling terminal?
I'm using C, but I'd be interested in libraries for other languages (for example, a C++ specific library).
...
Those of you that are even moderately knowledgable of math will likely laugh, but I don't remember what much of the notation rules in math and I need assistance converting this into C code. Your help is greatly appreciated:
214
10,000 {(10,000 × [1+.0599/365] )} +300
answer = ────────...
Hi,
I want to spawn Erlang processes that will communicate with a C program through a Port Driver.
As spawning many of these processes can be inefficient, can I spawn one Erlang process that receives messages and queue these messages for processing with the C Program?
As this C program starts to wait for incoming jobs, will it block?
...
What is the proper way of moving a player in Box2D setting Player->ApplyForce() kind of feels like it lacks flexibility and control. What other ways might there be to do this?
Thanks
...
This is my current makefile.
CXX = g++
CXXFLAGS = -Wall -O3
LDFLAGS =
TARGET = testcpp
SRCS = main.cpp object.cpp foo.cpp
OBJS = $(SRCS:.cpp=.o)
DEPS = $(SRCS:.cpp=.d)
.PHONY: clean all
all: $(TARGET)
$(TARGET): $(OBJS)
$(CXX) $(CXXFLAGS) $(LDFLAGS) $(OBJS) -o $(TARGET)
.cpp.o:
$(CXX) $(CXXFLAGS) -c $< -o $@
%...
I'm trying to create an XMPP library (and later a server) from scratch in a new C-like programming language (although the language itself is irrelevant) as a means to learn what I can about the XMPP protocol and server software development in general.
As many of you know, XMPP is messaging protocol based on XML that depends on an enormo...