c

How does GMP stores its integers, on an arbitrary number of bytes ?

2^64 is still far from the "infinity" my ram/hard drive can handle... First I wonder how GMP works with memory/processor since it does some kind of shady optimisations... I was also wondering if there is a way of storing an integer (unsigned, it's easier) on an arbitrary number of bytes. For example, on 50 bytes, I would have a cap of ...

Can I define a type based on the result of some calculation?

I perform some calculations, based on the result, I would like to either use a short int or int for some type of data for the remaining program. Can (/How can) this be done sensibly in C or C++? I don't really care about the amount of memory used (i.e., 2 or 4 bytes), my primary aim is to access generic arrays as if they contained data o...

Scalable approach for handling timeout of various IPC requests

I have a server and a client. The client is capable of sending out various types of IPC requests. What are some proven approaches/frameworks for a generic timeout handling that can accomodate each type of request? Ideally, I would like to have: different behavior for handling timeout of different types of messages on client side, repo...

Reading CGI POST data the most efficient way

I'm in great need of a way to dig through potentially huge amounts of CGI supplied POST data. With reading the GET data it's no big deal, as I can just re-request the QUERY_STRING environment variable as often as I want, but with POST data which is supplied via stdin. I can only read it in once and have to store it somewhere. My curre...

HTTP stack in C

Hi all, Are there any HTTP protocol stacks implemented in C? Thanks in advance. Update: looking for client implementations. ...

Compile FastBoot (used for android user space flashing) on Windows

I have compiled FastBoot on Linux platform. But I am stucked while compile it on windows.I am using WinDDK for compilation of FastBoot on windows.In WinDDK, It is giving errors like missing "unistd.h","sys/time.h","zipfile/zipfile.h". Are there any replacement files for above said in windows?.Please suggest if any suitable method to por...

Read Extended ASCII Characters from File and Convert to ASCII Decimal Value

I am trying to read the contents of a file (which contains both 'standard' text and 'binary' data). I then need to take that character (standard or extended ASCII) and get the corresponding Decimal (int) ASCII value. I am having a heck of time getting it to work correctly. Here is a snippet of the code to help show what I am currently...

c++ array question

I want to initialize an double array with size 200, and its value is from 0 to 199 from index 0 to 199 in c++. i know i can do it by a simple For loop, but is there a way just to initialize the double array like this? Thanks ...

how much c programming should I know before indulging into sdl programming

I have programmed in c and I know about data structures and algorithms, but It has been a while since I programmed in c. I forgot things like how function pointers and some advanced stuff in c work. I want to try graphics programming using sdl. my question is how much of c should I know (for example should I know function pointers) befor...

Different result everytime it is called

Hello, Why is it that the following code does not print the same value each time it is run? Is there something that I overlooked? Thanks. #include <windows.h> #include <stdio.h> #include <winhttp.h> #pragma comment (lib, "winhttp") int main(void) { DWORD dwSize = 0; DWORD dwDownloaded = 0; LPSTR pszOutBuffer; BOOL bResults = FAL...

Zip file using C program

Is there any option to zip the file using C programme without using any external application (like Zip..)? ...

Type casting between char* and UBYTE* (unsigned char*)

Background: I am receiving a array as char* as a part of socket session. Now we have to match the Tokens (HTTP headers) out of it.Code here is that we have created a UBYTE* and getting the value from the char array after typecasting with UBYTE. Later same UBYTE pointer we are passing to other function which accepts char* after typecastin...

Most efficient way to get columns of a multi dimensional array in C

I'm trying to create a matrix data structure in C. I have a struct and have a two dimensional void pointer array (size is dynamically defined at the heap) for the cargo part(data) in this struct. Given a column index, I want to get the values of this column in a one dimensional array. It is easy to this with one for or while loop. But i...

How do I allocate memory and determine array sizes dynamically in C?

I am trying to teach myself C from a python background. My current mini-problem is trying to do less hard-coding of things like array lengths and allocate memory dynamically based on input. I've written the following program. I was hoping for suggestions from the community for modifying it in the following ways: 1.) Make first and ...

Using Perl on Solaris, how do I import a C (.so) library?

Is there any function to import a C library (.so) file in the Solaris operating system? In Windows I can use Win32::API, how about Solaris? Thank you. ...

Need some help writing my results to a file

Hello guys, My application continuously calculates strings and outputs them into a file. This is being run for almost an entire day. But writing to the file is slowing my application. Is there a way I can improve the speed ? Also I want to extend the application so that I can send the results to an another system after some particular a...

gtk+ Close second window

Hello, I have 2 froms, primary and secondary in my gtk+ application. In second from i have GtkButton - close. How can i close this form when button clicked. Not hide, i need close form. Thank you ...

Do I have to enter src and dst mac address in forged packet?

Hi I have started coding a packet injector and read up a bit on what one has to do. One thing I'm wondering though is when I create the IP header the h_source and h_dest fields should contain the mac address of the sender and receiver. Do I have to do this and is there a quick way to find out the mac address of the destination? Let's sa...

Allocating largest buffer without using swap

In C/C++ under Linux, I need to allocate a large (several gigabyte) block of memory, in order to store real-time data from a sensor connected to the ethernet port and streaming data at about 110MB/s. I'd like to allocate the largest amount of memory possible, to maximise the length of data sequence that I can store. However, I also need ...

how to make the c compiler print \n

how to make the c compiler print \n ...