c

C++, Embedded Linux, For Video HDMI Input/Output

Hello, This is a newbie question, but here we go... I would like to know how I would go about programming a small embedded linux board (I was thinking a TI Divinci based board) for a video input (via HDMI or Component) and then output to a TV (via the same HDMI connection). Along with the original video pass through, I would like t...

Confusion on recvfrom() in an application level protocol design

Assume Linux and UDP is used. The manpage of recvfrom says: The receive calls normally return any data available, up to the requested amount, rather than waiting for receipt of the full amount requested. If this is the case, then it is highly possible to return partial application level protocol data from the socket, even if desired M...

How to detect where my app collapsed in linux

HI, i am recently in a project in linux written in C. This app has several processes and they share a block of shared memory...When the app run for about several hrs, a process collapsed without any footprints so it's very diffficult to know what the problem was or where i can start to review the codes.... well, it could be memory overfl...

A C structure accessed in Java

I have a C structure that is sent over some intermediate networks and gets received over a serial link by a java code. The Java code gives me a byte array that I now want to repackage it as the original structure. Now if the receive code was in C, this was simple. Is there any simple way to repackage a byte[] in java to a C struct. I hav...

Compile options to suppress GCC warnings from other people's header files?

gcc 4.4.2 I am using these compile options in my Makefile. And my application links to several 3rd party libraries. -ggdb -Wall -Wextra -pedantic -std=c89 However, the pedantic is displaying many warning for the 3rd party libraries. I am wondering how can I avoid displaying these warning and still keep my compiler option pedantic. ...

From OpenMP to MPI

Hi, I just wonder how to convert the following openMP program to a MPI program #include <omp.h> #define CHUNKSIZE 100 #define N 1000 int main (int argc, char *argv[]) { int i, chunk; float a[N], b[N], c[N]; /* Some initializations */ for (i=0; i < N; i++) a[i] = b[i] = i * 1.0; chunk = CHUNKSIZE; #prag...

Why is windows select() not always notifying thread B's select() when thread A closes its end of a socket pair?

Hi all, A situation I have under Windows XP (SP3) has been driving me nuts, and I'm reaching the end of my tether, so maybe someone can provide some inspiration. I have a C++ networking program (non-GUI). This program is built to compile and run under Windows, MacOS/X, and Linux, so it uses select() and non-blocking I/O as the basis f...

start gdb using a pid

In general i see the process's pid which is running in the background and start dbx on that process using the command dbx -a <pid> similarly how could i do it using gdb? ...

Is there anything like Python's ctype for PHP? Accessing libraries without the need to write an extension?

Python has ctypes to access libraries. In PHP you write extensions for everything. Popular extensions like the one for libgd are available almost everywhere. Is there any extension which works like Python's ctypes, letting you access libraries without the need to write an PHP extension? ...

Is there a maximum limit to the size of a variable that should be allocated on a stack?

i declared a struct variable in C of size greater than 1024bytes. On running Coverity (a static code analyzer application) it reports that this stack variable is greater than 1024 bytes and therefore a cause of error. I'd like to know if I need to worry about this warning? Is there really a maximum limit to the size of a single stack var...

Problem in retrieving the ini file through web page

Hi All, I am using an .ini file to store some values and retrieve values from it using the iniparser. When I give (hardcode) the query and retrive the value through the command line, I am able to retrive the ini file and do some operation. But when I pass the query through http, then I am getting an error (file not found), i.e., the...

Interrupt-safe way to set function pointer in HiTech C on PIC32

I have an ISR defined to trigger on an external interrupt. The external interrupt may not always be enabled, but under certain circumstances I want to be able to register a function to be called ONCE within the interrupt from within the main code. The function might be replaced by another one, or removed, before the next interrupt. I do...

Computing different terms for a given pair of exponentiation having the same result

To understand the problem,let us consider these examples first:                                  46 = (22)6 = 212 = (23)4 = 84 = 163 = 4096. Thus,we can say that 46,212,84 and 163 are same.                                  273 = 39 = 19683 so, both 273 and 39 are identical. Now the problem is, for any given pair of ab how to comput...

Reading Source Code Aloud

After seeing this question, I got to thinking about the various challenges that blind programmers face, and how some of them are applicable even to sighted programmers. Particularly, the problem of reading source code aloud gives me pause. I have been programming for most of my life, and I frequently tutor fellow students in programming,...

#define for a success or failure

Hello, I am using a API that has a macro for success which is "NT_SUCCESS". However they don't have one for failure. So normally I have to do this. if(something failed) return !NT_SUCCESS; else return NT_SUCCESS; Having the !NT_SUCCESS I don't think is very readable. So I decided to do this: #define SUCCESS NT_SUCCESS #define...

C/C++ implementation of a subset sum kind of problem

I think that stackoverflow is rendering me even lazier than usual, but... The problem is simpler than knapsack (or a type of it, without values and only positive weights). It consists on checking if a number can be a combination of others, and the function shall return true or false. Ex: 112 and a list with { 17, 100, 101 } should retu...

usb read from sensor

I have tilt sensor that have usb. How I read data from tilt sensor with usb in C#. note : tilt sensor send data from usb connection. thanks... ...

linker error in c

how can i resolve a linker error in c? this is the error message: undefined reference to HPDF_Page_SetRGBStroke ...

Odd Pearson correlation coefficient results.

I have an assignment in my C programming class to write a program to get the correlation coefficient of 2 sets of real numbers. I've been given the equations, and it referenced wikipedia so I double checked the equations there. Here is a link to the equation, which seems to be pretty standard from my research: I've written the progr...

Turn a large chunk of memory backwards, fast.

I need to rewrite about 4KB of data in reverse order, at bit level (last bit of last byte becoming first bit of first byte), as fast as possible. Are there any clever sniplets to do it? Rationale: The data is display contents of LCD screen in an embedded device that is usually positioned in a way that the screen is on your shoulders lev...