c

C: Got stuck with dup2() :-(

Hello colleagues! I have prepared a program which emulates shell (cmd) interface using pipes. There are two versions of the program: 1. Using one pipe (using a pipe from parent to child communication) 2. Using double pipe (using two pipes from parent to child and from child to parent to communicate). So, the first program provides desi...

How to work with Strings in ARM?

This is a homework question. Frankly, I'm not sure how a C program delivers a string parameter to the assembly level. I have the function StringSearchInString( text, searchString); and the parameters text = "Hallo Alles klar" searchString = "ll" I know ARM delivers the parameters into register R0, R1 respectively for text, searchSt...

How to load kernel into memory, from an ISO.

Hello fellow nerds! At compile-time I link my Assembly bootstrap together with my kernel, into an *.img file, which I then convert into an *.iso image using MagicISO. I then boot from this *.iso image. But the problem is that I want to read the second sector of the file (the kernel) into memory at 0x1000. But I only know how to do so, wi...

Size of empty class and empty function ??

Hi Friends, What will be solution in the fallowing code Class A{} void func(){} printf("%d,%d",sizeof(A),sizeof(func)); Thanks in advance Prashant Dubey ...

I Have a problem with 2 FIFO for read and write in each

The attached code should allow the communication between 2 terminals. The communication is made through 2 FIFO, which are created in the current directory. The program has to open the 2 fifos and the son reads from STDIN and puts on the fifo1 and the father reads from the other fifo and prints on terminal. In this way the communication t...

Why do you not use C for your web apps?

Hello all, I was having a look at a few different web servers this morning when I came across G-WAN. As I understand, its a web server written in C and you have to make use of it by writing your websites/webapps in C. One clear benefit is speed as the G-WAN site suggests. However, on the forums, the creator of G-WAN asked why not use C...

2D OpenGL scene slows down with lots of overlapping shapes

I'm drawing 2D shapes with OpenGL. They aren't using that many polygons. I notice that I can have lots and lots of shapes as long as they don't overlap. If I get a shape behind a shape behind.... etc.. it really starts lagging. I feel like I might be doing something wrong. Is this normal and is there a way to fix this (I can't omit rende...

Creating a custom context menu Window (WinAPI)

I'm wondering how to create windows like these I'm refering to the one that says Marquee selection tool... these ones. I'm also not referring to the skin. I know how to do my own drawing and what not, this is not the issue. It's because windows usually need a parent which means it should not be possible for these windows to overlap int...

General C/Objective C Question

I was going through Apple's documentation & I saw something like this (void (^)(void)). Can somebody explain what this statement means. ^ is XOR right... void XOR void doesn't makes much sense to me ...? There was also something like (void (^)(BOOL finished)) ...

Is it possible to map an address to the result of a function?

Hey guy, I'm writing a NES emulator in C/C++ for Mac OS (I've already written one, so I know the basics). Since many hardware registers are mapped to memory locations, I was wondering if there was some syscall I could use to map an address to the result of a function: when it would be accessed, the function would be called. (I'm pretty ...

Are "Statement and Declarations in Expressions" specific to GNU C ?

Are Statement and Declarations in Expressions specific to GNU C ? Or this feature is also included in C99 standard ? ...

Java code for converting C program to Control Flow Graph

I require a java code for converting a C program into a control flow graph. Can any one please help me out with it? ...

CUDA: cudaMemcpy returns cudaErrorInvalidValue for __device__ array

When I define an array on the device (that is initialized with a "Hello" string in this example) and try to copy this to the host, I get the error code cudaErrorInvalidValue. However, from inside a kernel, the d_helloStr[] can be accessed. Referring to the CUDA programming guide chapter B.2.1, such a variable should also be accessible th...

Windows C SHA256 Invalid Generation Issue

Hey there. I'm having a very strange problem with creating sha256 hashes. I made a simple C console program that takes a file path as an argument and uses the standalone sha256 code that can be found here. I compiled the program using MinGW 5.1.6 on Windows 7 x64. When testing the program on a file, the resultant hash is wrong. I made s...

Making Vista / 7 User Frame control? (WinAPI)

I notice Vista/7 uses this type of control as well as Windows Live Messenger. This is the control: How can this control be programably added to a WinAPI application? Thanks ...

Window Style for shading?

When a menu item or context menu is made, it has a shadow, if I create a window with WS_POPUP instead of WS_CHILD it has no shadow. How can I get the shadow? Thanks ...

looping through properties in struct - C

Can I use a forloop to get the property names of a "struct" in C? Or would I just have make a separate list? (Just the name I am looking for) ...

Malloc & Init - MACRO

Is it possible to rewrite the following code, so that it would be ISO C compliant ? The following macros are doing a malloc & init for a given type and value. The current code works with the gcc compilers (uses a gcc extension), but it's not standard. If I use -pedantic, I receive warnings. #ifdef __GNUC__ #define NM_CVPTR(type, valu...

Debug Break on Win32 Api functions

I would like to have a break on the SetTimer function in order to see which components register what timers with what values. Is this possible? ...

Why there is not a comprehensive c archive network?

There are websites as collections of python/perl/R libraries. Why there is not an equivalent one for c? I searched the internet and only found a small website calling itself CCAN. There are only a few libraries in that website. If I need extra libraries for c programming, where can I find them? Is there an well organized website of the...