Which way is standard to generate IETF-syslog messages in the C language?
There is the header <syslog.h>. But it provide no options to use the STRUCTURED-DATA mechanism (rfc-5424).
Of course, messages could be constructed by hand directly to a socket. But it seems that such way is not standard.
Is there another standard way?
...
I'm really not sure what to do anymore. I'v made my application use VBO's and my cpu usage still goes into the 70's and 80's. My render proceedure works like this:
Set the camera transformation
if the shape has not been tesselated, tesselate it.
create it's VBO
if it has a VBO, use it.
You will notice I have display lists too, I might ...
Hi,
I cannot find windows.h in my include folder of Turbo C and hence cannot work with the Win32 api's
Can someone please suggest a workaround?
thanks
...
My question is mostly about STL than the rest of the C++ that can be compared (I guess) to be as much fast as C a long as classes aren't used at every corner.
STL is standard for games and in engines like OGRE3D, but I was wondering that if STL's features are nice to use, the problem is while I don't really know how they work, I should ...
I have an array of nearly sorted values 28 elements long. I need to find the set of values that sums to a target value provided to the algorithm (or if exact sum cannot be found, the closest sum Below the target value).
I currently have a simple algorithm that does the job but it doesn't always find the best match. It works under idea...
I am using raw sockets with TCP. Whenever a packet gets sent to me, my computer send a RST packet back. I tried http://udi.posterous.com/suppressing-tcp-rst-on-raw-sockets, which isn't working:
int main(void) {
struct addrinfo *info, hints, *p;
int status, sock;
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC;
h...
I'm trying to evaluate different substring search (ala strstr) algorithms and implementations and looking for some well-crafted needle and haystack strings that will catch worst-case performance and possible corner-case bugs. I suppose I could work them out myself but I figure someone has to have a good collection of test cases sitting a...
When programming in C, is it better practice to use #define statements or enums for states in a state machine?
...
Any programming language that does not have a suitable reflection mechanism I find seriously debilitating for rapidly changing problems.
It seems with certain languages its incredible hard or not possible to do:
Convention over Configuration
Automatic Databinding
AOP / Meta programming
with out reflection.
Some example languages th...
I want to set the GtkTexetView background colour to the window's default colour so that it looks like a GtkLabel. Take a look at these images, but please note that I want it for C and not PHP, and I use GNOME, not MS Windows.
...
Reading through Cactus Kev's Poker Hand Evaluator, I noticed the following statements:
At first, I thought that I could always simply sort the hand first before passing it to the evaluator; but sorting takes time, and I didn't want to waste any CPU cycles sorting hands. I needed a method that didn't care what order the five cards were g...
How can I distinguish between "listener" file descriptors and "client" file descriptors?
Here's what I saw in the manpage example:
if(events[n].data.fd == listener) {
...
} else {
...
}
'But what if I don't have access to listener?
Sorry if this is a vague question. I'm not quite sure how to word it.
...
hello,
I am pasting some code here that compiles with no warning using gcc file.c -lxml2, assuming that libxml2 is installed in your system.
#include libxml/parser.h>
#include libxml/xpath.h>
#include assert.h>
#include libxml/tree.h>
#include libxml/xpathInternals.h>
xmlDocPtr
getdoc (char *docname) {
xmlDocPtr doc;
doc = x...
So, I recently added a header file (and corresponding source file) to a project, along with a header file that file required, and an object file that the file required.
Everything compiles fine, unless I actually make a call to one of the functions declared in the newly added header file.
This is all using Visual Studio Express 2008.
...
Hi every one,
i am looking for a way, how i can integrate a c++ code with fortran code (i want simply call some C/C++ functions in the fortran code).
I have found some proposals for gcc or console compilers, but i have not any idea how to translate this approach to solve integrationproblem within the visual studio.
At the time I am thi...
As suggested: I have a file which is larger than 2 giga. I am mapping to memory using the following function:
char* ptr = (char*) MapViewOfFile( map_handle,
FILE_MAP_WRITE | FILE_MAP_READ, 0, 0, 0 );
I parse ptr to rapidxml which accepts Ch* . As per the documentation from rapidxml ptr should be modifiable but since it is decl...
Hey everyone,
I've recently started a new web development project for an embedded device and wanted to solicit some recommendations for technologies to use. The device will serve HTML pages which include AJAX code to retrieve data from a JSON server. We're tentatively using Cherokee as the web server, though we're not tied to it.
Curre...
//Hydroelectric Dam Helper
#include <stdio.h>
#define GRAV 9.80
#define EFINC 0.9
#define EFINC2 90
int main()
{
//Defines all the variables to be used
double height, work, mass;
printf("Height of dam (in meters):");
scanf("%lf", &height);
printf("Flow of water (in thousand cubic meters per second):");
scanf("%lf", &mass);
...
I am writing a program to read info from a text file and I had everything working. The problem is that I am trying to add the functionality to calculate the mean of some of fields and have to convert the strings to doubles. I noticed that atof would work in some cases but would return -1 for the most part. i then realized that I didn'...
#include <stdio.h>
#define TimeConverter 60
#define TempFormula time * time * 4 / time + 2 - 20
double HoursMinToTime(int hour, int min);
double Temperature(double time);
int main()
{
int hour, min;
double time, temperature;
printf("Hours and minutes: ");
scanf("%d %d", hour, min);
//Segfault HERE
time = HoursM...