c

How to fix indentation in C, C++ and Fortran ?

Possible Duplicates: Code polisher / reformater for C, C++ or Fortran Best C++ Code Formatter/Beautifier I have code in C, C++ and Fortran (both f77 and f95) in a strong need for proper indentation (that is: they have none). I remember some tool to fix indentation, although I'm unable to find it, and as far as I recall, it j...

Free or cheap tools for commercial developement

I'd like develop software which in future I'd like to sell. Qt licence for one user, one OS costs ~2500 euro! I'm student and profit from sold software would be lower than QT Commercial licence cost. What tools (free or cheaper?) I can use for commercial software developement? (windows and linux, c/c++/c#). ...

Preprocessor Timestamp

Is it possible to generate an embedded Unix timestamp via a preprocessor macro? For instance: #define VERSION_EXPIRE __TIMESTAMP__ The reason for this is, that i have beta versions and i want to generate an expire timestamp on compile time (in a special Debug build configuration). Regards, Erik ...

Linear interpolation in direct digital synthesis

I'm working on a microcontroller DDS project in C and am having some trouble figuring out how to compute a linear interpolation to smooth the output values. The program as it stands now uses the top 8 bits of a 24 bit accumulator as an index to an array of 8 bit output values. I need to come up with a function that will take the middle...

Linking Error in Sun Studio 10 under Solaris

I wrote a test program like this: #include <sys/socket.h> int main( void ) { int sock = socket(AF_INET, SOCK_DGRAM, 0); return 0; } And tried to compile it: $ /tool/sunstudio/bin/cc test.c Undefined first referenced symbol in file socket test.o l...

Two different Output...

#include<stdio.h> int main(void) { static int i=i++, j=j++, k=k++; printf("i = %d j = %d k = %d", i, j, k); return 0; } Output in Turbo C 4.5 : i = 0 j = 0 k = 0 In gcc I'm getting the error: Initializer element is not constant Which one is logically correct ? I'm in bit confusion.. ...

opencv matrix into shared memory

Hi! I want to share between two linux processes a CvMat object (a matrix in the OpenCV library), for that I'm using shared memory. One process (server) will capture a frame (matrix) from the webcam, convert it to gray scale, share it using shared memory and show the frame on the screen. The other process (client) will read the shared fr...

As simple as possible crossplatform Java UPNP hole punching library.

I need a library with simple API. Defining simple: perfect solution for me would be something like described here but addopted for crossplatform use in Java (crossplatform for me is stand alone desctop app for Win, Mac, Lin)... So how API I would like to see looks like? Like oneI have in C#: using TCMPortMapper; private void Form1_Load...

pcap datalink LINUX_SLL

Hi, I'm trying to write a simple packet sniffer using libpcap. The first thing i'm trying to do when i capture a packet is to recognise the datalink protocol used and find the size of the header for that protocol in order to find the ip packet. The problem is that sometimes libpcap returns as datalink layer protocol the LINUX_SLL which ...

Edge length in an adjacency list

Where would be the best place to put the edge length in an adjacency list implementation? I using this site as reference. What I am thinking is to put it in the edge node so to find the length from one vertex to another, you go to one of the vertex nodes and find its connecting edges and access the relevant member. (see part 5: "Data typ...

What is the intention of putting return values in parentheses in C/Objective-C?

I've come across some code that surrounds the return value from a method/function in parentheses. What does that do? The code I saw took an image, resized it and then returned it. - (UIImage *)resizeImage:(UIImage *)image { // // some fascinating, but irrelevant, resizing code here // return (image); } ...

how to use unix libraries in visual studio 2008

I have c code that is using unix libraries and in linking ihave the following error: error LNK2019: unresolved external symbol "double _cdecl dlamch(char *)" (?dlamch_@@YANPAD@Z) referenced in function "double __cdecl Num_dlamch_primme(char *)" (?Num_dlamch_primme@@YANPAD@Z) s iwant away to use the unix libraries in visual studio 2008...

opencv every frame processing

Hi all! I want to write a crossplatform application using opencv for video capture. In all the examples, i've found frames from the camera are processed using the grab function and waiting for a while. And i want to process every frame in a sequence. I want to define my own callback function, which will be executed every time, when a new...

The use of error by struct keyword

typedef struct error{int warning, error, exception;}error; main() { error g1; g1.error =1; printf("%d",g1.error); } Here is code sample of whose output is 1. But I need a explanation of how this code is working ? ...

How does a C compiler find that -lm is pointing to the file libm.a ?

What's .a files in C programming in linux ? Is it library file ? To merge with the math library libm.a you would type cc -o program_name prog.c -lm when you compile the program. The -lm means: add in libm. If we wanted to add in the socket library libsocket.a to do some network programming as well, we would type cc -o program_name...

how to remove some data from pe (exe) file in C

hi, in first exe i have defined array of char with some special bytes as label, i mapping it to memory from another exe, finding needed label and putting in it new data, but this data could be shorter then defined array, so i want to cut this array to needed size! how can i do it? ...

How to "multithread" C code

Hi, I have a number crunching application written in C. It is kind of a main loop that for each value calls, for increasing values of "i", a function that performs some calculations. I read about multithreading, and I am considering learning a bit about it, in C. I wonder if somehow general code like mine could be automatically multithr...

single-lane bridge problem

If you're unfamiliar with the problem, it's something like this. I didn't come to ask for an answer, I have actually finished all of my coding. I have just found that my solution doesn't solve it the best way possible, because my solution only allows one car at a time on the bridge. I was hoping I could get some tips about how to go ab...

Looking for a fast outlined line rendering algorithm

I'm looking for a fast algorithm to draw an outlined line. For this application, the outline only needs to be 1 pixel wide. It should be possible, whether by default or through an option, to make two lines connect together seemlessly, if they share a common point. Excuse the ASCII art but this is probably the best way to demonstrate it....

How to read command line inputs using a C program

Hi, How to read command line inputs using a C program. by command line inputs, I don't mean command line arguments!! example: * I have a text file 'inputfile.txt' with few lines of names. * Assume my program name is names.exe. * I have to run the program using windows command line using following command: c:>names.exe < inputfile...