c

Empty or "flush" a file descriptor without read()?

(Note: This is not a question of how to flush a write(). This is the other end of it, so to speak.) Is it possible to empty a file descriptor that has data to be read in it without having to read() it? You might not be interested in the data, and reading it all would therefore waste space and cycles you might have better uses for. If ...

Is there anything like PPI or Perl::Critic for C?

PPI and Perl::Critic allow programmers to detect certain things in the syntax of their Perl programs. Is there anything like it that will tokenize/parse C and give you a chance to write a script to do something with that information? ...

How to embed WebKit into my C/C++/Win32 application?

The solutions I have found are irrelevant: someone used WebKit in a Delphi project someone used it with Java there is QtWebKit (about:blank demo app takes 44 megs) .Net port of it GTK+ port I need a guide how to embed WebKit instance into a pure C/C++ application under Win32. ...

deep copy Linkedlist without destroying original list and extra storage space (using ANSI C)

this linkedlist is different than normal linkedlists is that besides the next pointer, it also has a other pointer that points to another node except itself in the linkedlist. so what's the best way to deep copy this linkedlist without destroying the original and no extra space? My approach was simply doing a O(n^2) loop , but should b...

Rules Engine in C or Python

I am looking for a rules engine in C or Python, but if you know a rules engine that is implemented in another language I would be glad to know about it. The engine will be used as way to automate a house, like turning the light off when somebody leaves a room etc. So no "office" rules there (aka do you rules in Excel or such). I have l...

Is it worth learning C as a web developer? Will I ever use it?

As a web developer, is it worth me learning the programming language C? Will I ever need to use it? I am currently using PHP and Ruby on Rails. Thank you in advance to all you good people out there ...

What kind of applications should be rewritten to use OpenCL?

Mac OS X 10.6 comes with OpenCL, but how many applications could have better performances if they would be rewritten to use OpenCL? What kind of applications should be rewritten to use OpenCL? ...

Profiling a Set implementation on 64-bit machines

Relevant Information on my system: Core2Duo T6500 gcc (GCC) 4.4.1 20090725 (Red Hat 4.4.1-2) Using the basic set implementation, where each set that is stored is really just the lexicographical order of the set stored, you can use standard bit operations for Set operations like Union, Intersection, elementQ, etc. My question is about ...

Does moving values of one type with another type violate strict aliasing?

Does it violate strict aliasing rules to move items of any type around using uint32_t, then read them back? If so, does it also violate strict aliasing rules to memcpy from an array of uint32_ts to an array of any type, then read the elements back? The following code sample demonstrates both cases: #include <assert.h> #include <stdio....

Using Apple Scripting Bridge in C

I'm wondering if it is possible to use Scripting Bridge (as discussed here) in C. What I'm trying to do is control and/or get information from Apple applications (such as iTunes, see link listing 2.1 & 2.2 on above link) which is fairly easy using Objective-C. I could write those parts in Objective-C using C, but that would get pretty c...

How to pass data as XML via sockets ?

Hi, Could someone please help and provide me links where I can find materials/examples describing how to exchange data in the form of XML schemas between socket programs written in C/C++? Actually I have two software tools running in different OSs, in which I coupled with socket programs written in c/c++. As both work with xml, I am loo...

why are RTOS coded only in c?

Is it necessary to code RTOS in C language always? Why can't that be coded in java or some other technology..?? Is that because of the absence of pointer concept in java? ...

Padding error - when using AES Encryption in Java and Decryption in C

I have a problem while decrypting the xl file in rijndael 'c' code (The file got encrypted in Java through JCE) and this problem is happening only for the excel files types which having formula's. Remaining all file type encryption/decryption is happening properly. (If i decrypt the same file in java the output is coming fine.) While i...

Dynamically assigning numbers to an array in C

Hello, I want to do this: char a[5]; //run some code here //then a[]={0,1,2,3,4}; //**compiler doesn't like it but I don't want to do this: a[0]=0; a[1]=1; a[2]=2; a[3]=3; a[4]=4; Do you know any way to populate an array at run time with numbers, not a string (i.e., not a ="hello"), in one go, instead of defining every element ...

Java SSLSocket handshake failure

I'm trying to find a way to establish a connection beetwen a Java client and a C server using SSL. This is the java client: import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.OutputStreamWriter; import javax.net.ssl.SSLSocket; import javax.net.ssl.SSLSocket...

For real-time application, which is better C or C++?

I’m electronic engineer with experience with both language C and C++ (I wrote with C for micro-controller and with C++ I wrote for Windows with Borland C++ Builder) My company develops motor control products, and we are working with STM32 and IAR compiler. I recognize the technical differences between the languages, I interest in the d...

Access a 16 Bit DLL.

I have been given the task to upgrade an existing 16 Bit Desktop application originally written in GFA Basic. I want to know if there is a possibility to access the functions inside these 16 Bit Dlls via C/JNI (or any other programming language). I guess, I have to write some sort of an intermediate DLL to access the functionalities from...

declaring the unix flavour in C/C++

how do i declare in C/C++ that the code that is written is to be built in either HP-UX or solaris or AIX? ...

function pointers query

what is the difference between these two below: typedef void (*my_destructor)(void *); typedef void (*my_destructor)(void *) my_func_ptr; is the second one valid? ...

x86: howto catch data-alignment faults (aka SIGBUS on sparc)

Is it somehow possible to catch data-alignment faults even on i386? Maybe by setting a i386 specific machine register or something like that. On Solaris-Sparc I am receiving a SIGBUS in this case, but on i386 everything is fine. Environment: 32-bit application Ubuntu Karmic gcc/g++ v4.4.1 EDIT: Here is why I am asking this: our ...