Hi Everyone,
i need some advice and help with a plugin i am writing for Nagios.
i am writing the plugin in C, but have no previous experience in the language except for minor amounts whilst trying to get this plugin to work.
basically what i am trying to-do is the following.
read a text file that is generated on a remote PC by an appl...
I'm learning C right now, and I copied this little snippet straight from the book I'm using. It segfaults when I run it and I can't figure out why, I ran it through gdb and it stops at line 9 scanf("%s", aName);, but printing the values of the variables brings up nothing suspicious looking. What's wrong with this thing?
#include <stdio....
Although it's true that some
recursive-nameserver configurations
are (sloppily) referred to as
"caching", e.g., by
RHEL/Fedora/CentOS, that's a really
bad name for that function -- because
caching is orthogonal to recursion.
Theoretically, you could write a
nameserver that does recursive service
but doesn't cache ...
Hi,
EDIT: Thanks for the answers so far, at least I can compile it now, but I still get a segmentation error.
For compilation I use the following line:
gcc -g -O0 -I../include -L../ test.c -static -lrt
Source Code is as follows:
#include <sys/time.h>
#include <time.h>
#include <stdio.h>
struct timespec *diff(struct timespec *start...
How can I prevent the debug popup window from appearing when an assertion fails on a Windows machine? The app I'm writing is console based and I'm using assert() to test certain things when it's executed in test mode. I'm using MinGW + GCC 4.
Edit: This is the test program.
#include <stdlib.h>
#include <assert.h>
int main(void) {
...
For example, say we have a union
typedef union {
unsigned long U32;
float f;
}U_U32_F;
When a variable of this union type is declared, is there a way to set an initial value?
U_U32_F u = 0xffffffff; // Does not work...is there a correct syntax for this?
...
I perform some checks in my Window class constructor, and if they fail I want to display an error message and close the window.
I'm getting crashes when calling Close() from the constructor or from Window_Loaded. Does that sounds normal or am I doing something wrong? If this is normal, when should I call Close()?
...
I am attempting to run a fastcgi app written in C language behind the Nginx web server. The web browser never finishes loading and the response never completes. I am not sure how to approach it and debug. Any insight would be appreciated.
The hello world application was taken from fastcgi.com and simplified to look like this:
#include...
Hi,
i would like to play with the constructing calls feature of gcc...
From the doc :
— Built-in Function:
void * __builtin_apply (void (*function)(), void *arguments, size_t size)
This built-in function invokes function with a copy of the parameters
described by arguments and size.
The value of arguments should be...
I would like to know how to create console applications with better control of input and output using C. For example, how does the text-editor nano display the file contents in a certain portion of the screen and then keep a list of commands stationary on the bottom. I know you can use the win32 api to do this in Windows, but what is t...
I have read this regarding setting a socket to non-blocking mode.
http://www.ia.pw.edu.pl/~wujek/dokumentacja/gnu/libc/libc_8.html#SEC141
Here is what I did:
static void setnonblocking(int sock)
{
int opts;
opts = fcntl(sock,F_GETFL);
if (opts < 0) {
perror("fcntl(F_GETFL)");
exit(EXIT_FAILURE);
}
...
I would like to measure time in C, and I am having a tough time figuring it out, all I want is something like this:
start a timer
run a method
stop the timer
report the time taken (at least to micro accuracy)
Any help would be appreciated.
(I am compiling in windows using mingw)
...
In Linux, if two threads are created and both of them are running, when one of them calls recv() or any IO syscall that blocks when no data is available, what would happen to the whole process?
Will the other thread block also? I guess this depends on how threading is implemented. If thread library is in user space and kernel totally u...
If I try to compile a program with
#include <pthread.h>
in it, I get the error:
pthread.h: No such file or directory
Is it possible to get this to compile in a Windows environment?
I am using Vista with the latest mingw
I do not want to use the Microsoft Windows Services for UNIX Version 3.5 as I will have to move this to a Unix en...
I want to represent a 2D array with a 1D array. A function will pass the two indicies (x,y) and the value to store. These two indicies would represent a single element of a 1D array, and set it accordingly. I know the 1D array needs to be (arrayWidth *arrayHeight) in size, but I don't know how to set each element. For example if I passed...
I am trying to run Cygwin, and I am running into some problems. I tried to compile a program that works both on Windows with mingw and on a Unix system, but when I go to compile it through Cygwin:
gcc threads.c -o threads
I get the error:
this application has requested the runtime to terminate it in an unusual way
And that's it... a...
#include<stdio.h>
int main()
{
unsigned char c;
c = 300;
printf("%d",c);
return 0;
}
Is the output in any way predictable or its undefined??
...
Hi,
I'm trying to compile a C program using GTK+ in bloodshed Dev-C++ 4.9.9.2.
I've added all the include files in the compiler options plus all compiler options, but I get the following error:
Compiler: Default compiler
Building Makefile: "C:\Dev-Cpp\Projects\Makefile.win"
Executing make...
make.exe -f "C:\Dev-Cpp\Projects\Makefile....
I am working on a c parser and wondering how expert manage large amount of text / string (> 100mb) to store in memory?
the content is expected to be accessible all the time in fast pace.
bg: redhat / gcc / libc
a single char array would be out of boundary causing segmentation fault...
any idea or experience is welcomed to share / dis...
I'm downloaded the Java EE version of Eclipse 3.5.1. Can I now use it to edit C/C++ with the proper plugin?
I went to Help >> Install New Software but I don't know which URL to use to get the C/C++ plugin. I can't find it on the Eclipse website either.
...