c

Can I redistribute Phing with non-free software?

I am having trouble understanding the terms of the LGPL in light of a program that is not written in C or C++. They speak of libraries being linked and 'derivitive' works. If I were to package a php program and sell it, but within the program the deployment mechanism used the phing package (full up with the entire contents as is and un...

portable way to deal with 64/32 bit time_t

I have some code which is built both on Windows and Linux. Linux at this point is always 32bit but Windows is 32 and 64bit. Windows wants to have time_t be 64 bit and Linux still has it as 32 bit. I'm fine with that, except in some places time_t values are converted to strings. So when time_T is 32 bit it should be done with %d and w...

C/C++ for Core Logic Development of a Web Application?

Can C/C++ be choice of keeping all your logic (business/domain) for web application? Why? I've two resources (cousins) having knowledge on C/C++ and me also good in C/C++, Python, HTML, CSS and JavaScript. We like to utilize our free time to work on our some good ideas we developed together. The ideas require knowledge of web applica...

Chunked responses in libevent2

Hi I am trying to do a chunked response (of large files) in libevent this way:: evhttp_send_reply_start(request, HTTP_OK, "OK"); int fd = open("filename", O_RDONLY); size_t fileSize = <get_file_size>; struct evbuffer *databuff = NULL; for (off_t offset = 0;offset < fileSize;) { databuff = evbuffer_new(); size_t bytesLeft = f...

FTP file transfer on Windows platform using ANSI C ?

I have a known shared folder on another Windows PC and i have to transfer files using my ANSI C program to that shared folder using an FTP connection. I need some directions - please guide me. ...

C error Array : array type has incomplete element type.

Hi my code extern int docx(char *,char[][]) // in a header file it is compiled in solaries properly. but in redhat linux it shows bellow error. array type has incomplete element type. i know i can solve it as - char[][20] is it the right way. ...

Big o notation runtime

Hi, i have been given some code to work out big o runtimes on them, could someone tell me if i am on the right track or not?? //program1 int i, count = 0, n = 20000; for(i = 0; i < n * n; i++) { count++; } Is that O(n^2)? //number2 int i, inner_count = 0, n = 2000000000; for(i = 0; i < n; i++) { inner_count++;...

How to dynamically expand a string in C

Hi - I have a function that recursively makes some calculations on a set of numbers. I want to also pretty-print the calculation in each recursion call by passing the string from the previous calculation and concatenating it with the current operation. A sample output might look like this: 3 (3) + 2 ((3) + 2) / 4 (((3) + 2) / 4) x 5 (((...

Converting Bit Field to int

Hi, I have bit field declared this way: typedef struct morder { unsigned int targetRegister : 3; unsigned int targetMethodOfAddressing : 3; unsigned int originRegister : 3; unsigned int originMethodOfAddressing : 3; unsigned int oCode : 4; } bitset; I also have int array, and i want to get int value from this array...

Freeing memory twice

AFAIK, freeing a NULL pointer will result in nothing. I mean nothing is being done by the function free. Still, I do see some statements where people say that one of the scenarios where memory corruption can occur is "freeing memory twice". Is this still true? ...

Are +=, |=, &= etc atomic?

Are the "modify" operators like +=, |=, &= etc atomic? I know ++ is atomic (if you perform x++; in two different threads "simultaneously", you will always end up with x increased by 2, as opposed to x=x+1 with optimization switched off.) What I wonder is whether variable |= constant, and the likes are thread-safe or do I have to protec...

invalid use of array with unspecified bounds

Hello everyone, i had a question in my program. When I pass the 3D int array CodedGreen to the function Green_Decode_Tree. An error message"invalid use of array with unspecified bounds" displayed. What is the mistake in my program? Thanks for your help. for(i=0;i<256;i++){ for(j=0;j<256;j++){ Decode_Tree(green[0], CodedGre...

Resources for memory management in embedded application

How should I manage memory in my mission critical embedded application? I found some articles with google, but couldn't pinpoint a really useful practical guide. The DO-178b forbids dynamic memory allocations, but how will you manage the memory then? Preallocate everything in advance and send a pointer to each function that needs alloc...

Refactoring c / c++ in vim (e.g. method extraction like in eclipse.)

Hi Is there any plugins or built-in method in vim for performing refactoring on c or c++ code, something like the refactoring tools in eclipse? I'm especially keen on the extract method refactoring tool from eclipse that will determine parameters from new method and typically also guess a variable to use as return value. ...

Linux network programming. What can I start with?

Hi everyone! I've recently got interested in Linux network programming and read quite a bit (Beej's Guide to Network Programming). But now I'm confused. I would like to write something to have some practice, but I don't know what exactly. Could please recommend me a couple of projects to start with? Thanks. ...

Access command line arguments without using char **argv in main

Is there any way to access the command line arguments, without using the argument to main? I need to access it in another function, and I would prefer not passing it in. I need a solution that only necessarily works on Mac OS and Linux with GCC. ...

any good free C DSP library?

Hi everybody I am developing an application to process geophysical signals; Right now I have done everything in octave and its digital signal processing toolbox, speed is not bad, however the application specifications say I need to port to the final algorithm to C; I am doing lots of filtering, re-sampling and signal manipulation/chara...

Best and easiest algorithm to search for a vertex on a Graph?

Hi, After implementing most of the common and needed functions for my Graph implementation, I realized that a couple of functions (remove vertex, search vertex and get vertex) don't have the "best" implementation. I'm using adjacency lists with linked lists for my Graph implementation and I was searching one vertex after the other unti...

printing sequence number of a sniffed packet

i am using pcap to create a packet sniffer. i have this tcp structure: typedef struct TSP_header{ unsigned short int sport; unsigned short int dport; unsigned int seqnum; unsigned int acknum; unsigned char reserved:4, offset:4; unsigned int tcp_res1:4, //little-endian ...

Compile-time lookup array creation for ANSI-C?

A previous programmer preferred to generate large lookup tables (arrays of constants) to save runtime CPU cycles rather than calculating values on the fly. He did this by creating custom Visual C++ projects that were unique for each individual lookup table... which generate array files that are then #included into a completely separate A...