c

What is the meaning of the following?

int sampleArray[] = {1,2,3,4,5}; I understand that the sampleArray now points to the first element of the array. However, what does it mean when I say &sampleArray? Does it mean I am getting the address of the sampleArray variable? Or does it mean a two-dimensional array variable? So, can I do this: int (*p)[5] = &sampleArray? ...

Comparing floats in their bit representations

Say I want a function that takes two floats (x and y), and I want to compare them using not their float representation but rather their bitwise representation as a 32-bit unsigned int. That is, a number like -495.5 has bit representation 0b11000011111001011100000000000000 or 0xC3E5C000 as a float, and I have an unsigned int with the same...

fatal error C1014: too many include files : depth = 1024

I have no idea what this means. But here is the code that it supposely is happening in. //======================================================================================= // d3dApp.cpp by Frank Luna (C) 2008 All Rights Reserved. //======================================================================================= #include "d...

How to determine values saved on the stack?

I'm doing some experimenting and would like to be able to see what is saved on the stack during a system call (the saved state of the user land process). According to http://lxr.linux.no/#linux+v2.6.30.1/arch/x86/kernel/entry_32.S it shows that the various values of registers are saved at those particular offsets to the stack pointer. He...

directed unweighted graphs C

Hi, I'm planning to write a program in C that builds the adjacency list, performs the depth first search, performs the breadth first search, and performs the topological sort. Where can I get some info about this subject in C? Any help is appreciated ...

ReSharper/StyleCop-like Visual Studio addon for C/C++

Is there any ReSharper/StyleCop-like Visual Studio addon for C/C++? I'm using ReSharper and StyleCop addons every day. Just recently started a new project which involves C/C++ programming. I miss some features from these addons like code formatting, hints/tips to use cleaner and better code, documentation/uniform code requirements, opti...

how to stop this message on pressing CTRL + ALT + DEL?

i have the following code to disable task manager of windows xp but it still displays a message the "task manager is disabled" and we have to press ok how can i disable even this message ; i want that when any one presses ALT+CLRT+ DEL nothing happens even no message dialog. HKEY hMykey; DWORD pDWDisp; unsigned char cData[1]; cData[0]...

Reading DWORD from binary file

Why these lines of code doesn't work when i try to read a DWORD num = 1880762702 using fread(&num, "file path", 1, FILE*); I get the result = 10574 if I change the num to any other number say 2880762702 only then it works. ...

What is the best way to write class template-like generic code in C?

I need to write AVL-tree with generic type in C. The best way I know is to use [ void* ] and to write some functions for creating, copying, assignment and destruction. Please, tell me some better way. ...

Using Crypt32 with Dev-Cpp - Unable to link to CryptUnprotectData

Original Question While trying to compile the example code from 'Example C Program: Using CryptProtectData' I ran into a roadblock; The linker cannot find CryptUnprotectData. Here is the console output: Compiler: Default compiler Building Makefile: "C:\Dev-Cpp\test\Makefile.win" Executing make... make.exe -f "C:\Dev-Cpp\test\Makefile...

What is the Meaning of wild pointer in C ?

Hi,can anybody tell me,the meaning of wild pointer in C, how it obtain and is this available in C++ ? ...

Static library not included in resulting LLVM executable

Hi, I am trying to compile a c program using LLVM and I am having trouble getting some static libraries included. I have successfully compiled those static libraries using LLVM and, for example, libogg.a is present, as is ogg.l.bc. However, when I try to build the final program, it does not include the static ogg library. I've tried va...

Grammar and syntax of typedef in C language.

Hi folks: I have a problem with the typedef keywords in C language. In my program, I use the following codes: typedef int* a[10]; int main(){ int a[10]; } they work well. But why there are no conflicts between a variable and a type sharing the same name a? Regards. ...

How do I synchronize access to shared memory in LynxOS/POSIX?

I am implementing two processes on a LynxOS SE (POSIX conformant) system that will communicate via shared memory. One process will act as a "producer" and the other a "consumer". In a multi-threaded system my approach to this would be to use a mutex and condvar (condition variable) pair, with the consumer waiting on the condvar (with pt...

While loop not reading in the last item

I'm trying to read in a multi line string then split it then print it .. here is the string : 1T1b5T!1T2b1T1b2T!1T1b1T2b2T!1T3b1T1b1T!3T3b1T!1T3b1T1b1T!5T1*1T 11X21b1X 4X1b1X When I split the string with ! I get this without the last line string : 1T1b5T 1T1b5T1T2b1T1b2T 1T2b1T1b2T1T1b1T2b2T 1T1b1T2b2T1T3b1T1b1T 1T3b1T1b1T3T3b1T 3T3...

how to set the tab order for the UI controls in win 32?

hello all I have a small dialog which I created dynamically, which has a textbox and a button..if the user presses the TAB key it has to switch between the two control(textbox and button)...I tried using SetwindowPos...but it doesnt seem to solve my problem...please give me a solution for this..in the below code..I also tried to include ...

Converting a program from c to bash script

Hello! I have created a small program in c languge.This program creates some child procceses in with the fork() function.The amount of the procceses that are created is given as the first argument of the console. I would like someone to help me convert this program from c to bash script. /* The first argument is the amount of the procce...

Cross platform millisecond timer lasting more than 49 days?

Hey guys, I'm going to be developing a small dedicated server in C/C++ that will require uptime of forever. I've been looking into some time functions as millisecond timing is required for calculations. I have 2 problems that I'm facing: Using a 32bit integer to store the number of milliseconds since the operation began will wrap ar...

Tips on redefining a register bitfield in C

I am struggling trying to come up with a clean way to redefine some register bitfields to be usable on a chip I am working with. For example, this is what one of the CAN configuration registers is defined as: extern volatile near unsigned char BRGCON1; extern volatile near struct { unsigned BRP0:1; unsigned BRP1:1; unsigned...

Handling macro redefinition without modifying .h files ... C / C++ language

Background: Let assume that I have two header files a.h and b.h. a.h contains: #define VAR 1 b.h contains: #define VAR 2 Note: The name of both of the macro is same. Let say I have some file myFile.c which includes both of the header files i.e. a.h and b.h. When I try to access VAR, I get a redefinition error of VAR. In order t...