c

How to run a single .c file in a .lib project in visual C++ Express?

I tried right click that .c file,but there is only a "Compile" option. How to run the main function inside it? ...

Input output communication between two programs

I have a third party java program called kgsgtp.jar which need to communicate with my own C++ (but mainly just C) program. The documentation for the java program states: ===================== You just need to make sure that stdin for kgsGtp it connected to the engine's output and stdout for kgsGtp is connected to the engine's inpu...

Can't include a static lib(.lib) in visual c++

I've added a .lib to my c project, but still can't use things defined in that .lib in .c main() { structure_defined_inthat_lib c; ... I added that .lib this way: Right click ,property,Linker,Input, and in "Additional Dependencies",I type in "D:\path\name.lib" Anything wrong? ...

How does printf work?

Hello, I looked over but couldn't find a decent answer. I was wondering how printf works in case like this: char arr[2] = {5,6}; printf ("%d%d",arr[0],arr[1]); I was thinking that printf just walks through the format and when it encouter %d for example it reads 4 bytes from the it's current position... however that's gotta be misco...

Why is (void) 0 a no operation in C and C++?

I have seen debug printfs in glibc which internally is defined as (void) 0, if NDEBUG is defined. Likewise the __noop for Visual C++ compiler is there too. The former works on both GCC and VC++ compilers, while the latter only on VC++. Now we all know that both the above statements will be treated as no operation and no respective code w...

Printf and scanf work without stdio.h, why?

Possible Duplicate: Why #include <stdio.h> is not required to use printf()? Both printf and scanf have been declared in stdio.h. But they work even without that, dropping just a warning message? What's the theory behind this? ...

Assistance in basic bit manipulation

This is a follow on question from my previously answered question here: http://stackoverflow.com/questions/2185719/reading-characters-on-a-bit-level The problem that I seem to be having is understanding the basic concepts of bit manipulation in C. I understand what needs to be done but I am having trouble actually developing a solution...

Pass the current state of a function into another function in C/C++

Is there a way to pass the current state of a function into another function in C/C++? I mean all the parameters and local variables by current state. For example: void funcA (int a, int b) { char c; int d, e; // Do something with the variables. // ... funcB(); // Do something more. } void funcB() { // funcB...

What algorithms are available to resize a hash table?

I have implemented my own hash table functions in C, but currently it doesn't support resizing. I was wondering what algorithms do exist apart from the brute-force way of creating a new empty hash table and moving everything there? ...

Dynamic memory reallocation problem

Hi! Can anyone tell me why this program is giving a debug error with message "DAMAGE:after normal block(#42) at 0x00430050". The message is generated on line free(ptr); I suppose that the problem is connected with the reallocation of memory. #include<stdio.h> #include<stdlib.h> #define DELTA 5 void include(int d,int* p,int n,int k,int...

Why do we have pointers other than void

I know that we have different pointers like int, float, and char. A void pointer is the only pointer which can hold all others. Do the other pointers exist only for the flexibility to do pointer arithmetic? Is there any other reason that pointers other than void are present in C language? ...

How do I get GDB to break out of a loop?

I can tell GDB to return from a function immediately with return, and call a function with call myFunction. But how do I get it break out of the current loop? i.e. to act as if it's hit a break; statement. Is jump myfile.c:<linenumber> the way to do this? ...

Bitwise equality

I need to perform a bitwise equality between two bytes. That means that for instance if I have two bytes: 00011011 and 00011110 the result is 11111010 The only fast way I see is to use the following statement byte a, b;//set input bytes byte c = ~(a^b);//output bytes But I wonder if there is a faster solution for this. After these equ...

A good place to learn about image processing in c/c++?

any websites, books etc. If someone would like to share their own experiences. thank you ...

Is 0 or 1 valid return values for socket() function call

Could the socket function call in C return 0 or 1 as the value for the socket descriptor? int socket(int domain, int type, int protocol); According to the man page I have: RETURN VALUE -1 is returned if an error occurs; otherwise the return value is a descriptor referencing the socket. It seems like it could, or at l...

Implementing C file streams (FILE *, fopen, fread, etc.) on embedded platform

I've been tasked with adding streams support (C89/C90) to the libraries for my company's legacy embedded C compiler. Our target hardware typically has 1MB or less of code space and does not have an operating system. We have a lot of stream-like implementations throughout the codebase that I can use as a starting point. For example, a ...

Regex for string using GNU C regex library

Hello, I am writing a regex to use with the GNU C regex library: The string is of the form: (text in italics is a description of content) (NOT a #) start (maybe whitespace) : data I have written the following code, but it won't match. regcomp(&start_state, "^[^#][ \\t]*\\(start\\)[ \\t]*[:].*$", REG_EXTENDED); What do I need t...

Find all files within directory using "FindFirstFileA" - C

I am using the Windows API and would like to be able to search through a specified directory and return the names of any files that reside within it. I've made a start at it however i've hit a brick wall as i'm unsure of how to go any further. Here is my progress so far: #include <stdio.h> #include <windows.h> void main() { HANDLE f...

conversion of multiple ascii characters in a char array to single int using their ascii values --- c/c++

hi, anyone know a good way for doing this conversion? for example, take the char array holding ascii charcters "ABC", the int conversion i'm looking for would change those characters to a single int with value 656667. any help would be very much appreciated. edit really appreciate the replies. as someone noted i did say char array, an...

Library support for very high dynamic range TIFF files?

I work with satellite radar, and have been provided with a (very) large TIFF file containing 32 bpp greyscale data. Unfortunately, libtiff, the standard Linux library for working with TIFF files, doesn't support SampleFormat TIFF files, which means no support for high bit depth greyscale images or floating-point images. Does anyone know...