c

Is it recommend to trap SIGPIPE in bash script?

Hi, I have a problem while executing a bash script from C++ using the system call command. The script catch a SIGPIPE signal and exit with ret code 141. This problem has started to appear only in the last release of my code. My Questions are as follows: 1) Why does this SIGPIPE occur now and didn't occur before? 2) Is it safe to ignor...

how can i use Dll function in qt

how can i use this dll function?: extern "C"__declspec(dllexport) void __cdecl InvertRawPic(unsigned char *In, unsigned char *Out, unsigned int rows, unsigned int cols); in QT. This function is to invert images. ...

How to get Shared Object in Shared Memory

Our app depends on an external, 3rd party-supplied configuration (including custom driving/decision making functions) loadable as .so file. Independently, it cooperates with external CGI modules using a chunk of shared memory, where almost all of its volatile state is kept, so that the external modules can read it and modify it where ap...

openMP question

hello all, is it suitable parallelizing loops containing function call(s). or is it much more convenient parallelization of loops which are doing basic operation inside. for example is it suitable putting parallelization directives as below ? main(){ .. #omp paralel .. for (i=0;i<100;i++){ a[i] = foo(&datatype , ...); ... } .. } int ...

Update position of a point

Hi all. My problem is this: I have a set of points in 3D space, and their positions are updated from time to time with a certain velocity. But i need to keep a minimal distance between them. Can you help me with this? EDIT: I am using C for the implementation of the algorithm. Thanks in advance. ...

Is there a widespread C library for reading name/value pairs from a file?

My program is reading a text file containing various lines of text for a settings file. Some of the lines could get very large. Currently the buffer size is 4096 chars. It is possible that some lines could exceed this, whether through maliciousness or due to various factors operating within the program. The current routines were rather ...

Declare in C == define in C++ ?

Possible Duplicate: What is the difference between a definition and a declaration? Is it correct that to declare in C is equal to define in C++? int a; /* to declare variabel a in C */ int b = 2; /* to declare and initialize in C */ int c; // to define in C++ int d = 4; // to define and initialize in C++ ...

Any systematic way to avoid "reentry" problem? (embedded system)

We are using C to build a system on ARM core (i.e. an embedded system). The question is: how can we avoid reentry problem in a formal way so that we are confident all reentry bugs are removed. This may not be a practical wish but surely important for any system, I guess. Just for the discussion, I guess drawing UML diagram or have a com...

what does malloc(0) return ?

What does malloc(0) returns? Would the answer be same for realloc(malloc(0),0) ? #include<stdio.h> #include<malloc.h> int main() { printf("%p\n", malloc(0)); printf("%p\n", realloc(malloc(0), 0)); return 0; } Output from linux gcc: manav@manav-workstation:~$ gcc -Wall mal.c manav@manav-workstation:~$ ./a.out 0...

In Objective C where the predefined classes are stored ?

In C if we include #stdio.h we get some functions like printf, scanf. In the same way for Objective C what we should do to include NSLog,NSArray,... and where the definitions of these NSLog, NSArray are stored ? Please clarify my confusion. ...

How can I compile C code that has already been C pre-processed with GCC?

I'm performing some source processing between C preprocessing and C compilation. At the moment I: gcc -E file.c > preprocessed_file.c. Do more stuff to preprocessed_file.c. Continue the compilation with preprocessed_file.c. If you attempt to compile preprocessed_file.c as you would if it was normal C (step 3) you get lots of the foll...

uncompress gzipped HTTP message

Hi everybody, I am analyzing Pcap captures with C and I need to uncompress the Gzipped body of the HTTP replies. I know that I can do that using Wireshark manually, but I would need to do it on the fly, inside my program. My understanding is that I should look into zlib and the RFC. But since it's a little analysis program, do you know...

assembler programming in user space

Hi, Is it possible to have a piece of code like this in user space? I mean is it possible to read/write co-processor register in user space in Netbsd / Linux? XYZ]# cat pmc.c static inline int arm11_pmc_ctrl_read(void) { unsigned int val; __asm volatile ("mrc p15, 0, %0, c15, c12, 0" : "=r" (val)); return val; } int mai...

ansi c: converting argv into int

hi i wanted to convert the argv in ansi-c into int. i am not sure of a few things... int main(int argc, char* argv[]) let's assume my program is run as follows ./a input1 input2. let's assume in this case that my input1 = 12345 and input2=67890 i don't want to use atoi. i wanted to convert it all by my own. for example when i call ...

The C `clock()` function just returns a zero

The C clock() function just returns me a zero. I tried using different types, with no improvement... Is this a good way to measure time with good precision? #include <time.h> #include <stdio.h> int main() { clock_t start, end; double cpu_time_used; char s[32]; start = clock(); printf("\nSleeping 3 seconds...\n\n"...

What Linux library supports sockets, ioctl calls, tuntap, etc...?

What is the name of the runtime library which implements Linux network interfaces, like sockets, tuntaps, netlink, etc...? For example when I create an UDP socket and make an ioctl call to fetch network interface info, which library actually implements that call? What are the corresponding *.so files on most linux dstirbutions? ...

How to set the size of the Non-client area of a Win32 window (native)

How to set the size of the Non-client area of a Win32 window (native). What I want is to make the CAPTION/TITLE bar THICKER. I've read and been told that I should handle WM_NCCALCSIZE but I can't find nothing clear on the documentation. From MSDN: WM_NCCALCSIZE Notification The WM_NCCALCSIZE message is sent when the size and posi...

Windows equivalent to Linux's readahead syscall?

Is there a Windows equivalent to Linux's readahead syscall? EDIT: I would like a full function signature if possible, showing the equivalent offset/count parameters (or lower/upper). Eg: The Linux function signature is: ssize_t readahead(int fd, off64_t *offset, size_t count); and an example of it's use is readahead(file, 100, 500...

What do C and Assembler actually compile to?

So I found out that C(++) programs actually don't compile to plain "binary" (I may have gotten some things wrong here, in that case I'm sorry :D) but to a range of things (symbol table, os-related stuff,...) but... Does assembler "compile" to pure binary? That means no extra stuff besides resources like predefined strings, etc. If C co...

What is the cleanest way to create a timeout for a while loop?

Windows API/C/C++ 1. .... 2. .... 3. .... 4. while (flag1 != flag2) 5. { 6. SleepEx(100,FALSE); //waiting for flags to be equal (flags are set from another thread). 7. } 8. ..... 9. ..... If the flags don't equal each other after 7 seconds, I would like to continue to line 8. Any help is appreciated. ...