Need an easy WinAPI grid in C
I am looking for a grid control that can be controlled via WinAPI messages. I have tried the BabyGrid from CodeGuru but it is very slow when it comes to displaying on large screen. Anyone know of a good one? ...
I am looking for a grid control that can be controlled via WinAPI messages. I have tried the BabyGrid from CodeGuru but it is very slow when it comes to displaying on large screen. Anyone know of a good one? ...
Is it safe to count on ints always being initialized to 0 in C? More specifically, when an object with int ivars has been newly instantiated in Objective-C, is it safe to assume that those ivars have value 0? ...
Hello, I search for the fastest or simplest method to compute the outer angle at any point of a convex polygon. That means, always the bigger angle, whereas the two angles in question add up to 360 degrees. Here is an illustration: Now I know that I may compute the angles between the two vectors A-B and C-B which involves the dot pr...
I would like to know if a pointer stores the address of any variable ... then from where do we get the pointer? What I asked was that if we are using pointer directly, then there must be a location from where we get this pointer? Please help, I'm gettin confused ... :(( ...
I'm implementing a single-producer single-consumer queue, by which one thread waits for the global queue to be filled by another thread like this: while (queue.head == queue.tail); When I compiled the program will gcc -O0, it worked well. But when it was compiled with gcc -O1, deadloop happened. Then I looked into assembly code and fo...
I know that you can declare an array in C like this: int nums[5] = {0,1,2,3,4}; However, can you do this? int nums[5]; // more code.... nums = { 0,2,5,1,2}; In other words, can I initialize the array using the bracket notation at any other time than just the declaration? Thanks for your time, Sam ...
I have functions lock(), unlock(), query1(), query2() and query3(). The query functions just run some query on a database and can be considered r/w access to it. They do not lock. My system is multithreaded. The functionality I want is: If lock() is called from thread p1, only queries from thread p1 will run and queries from all other t...
Hi, We have a c file called dbookpy.c, which will provide a Python binding some C functions. Next we decided to build a proper .so with cmake, but it seems we are doing something wrong with regards to linking the external library 'libdbook' in the binding: The CMakeLists.txt is as follows: PROJECT(dbookpy) FIND_PACKAGE(PythonInterp)...
#include <stdio.h> #include <string.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include <arpa/inet.h> int main(int argc, char *argv[]) { //set up hints struct addrinfo hints; struct addrinfo *res; struct sockaddr their_addr; socklen_t sin_size = sizeof their_addr; ...
Just a simple doubt: Is it possible to call a java function from c/c++ ? ...
Possible Duplicate: What REALLY happens when you dont free after malloc? When ending a program in C/C++, you have to clean up by freeing pointers. What happens if you doesn't free the memory, like if you have a pointer to an int and doesn't delete it when ending the program? Is the memory still used and can only be freed by rest...
Hi I try to implement point lights in OpenGL with GLSL. I send all the required data to the shaders. For simplicity I only use the diffuse light here. My example shows a huge triangle which I want to illuminate with a single light source. The light source is shown as a small blue triangle. For diffuse light I need to know the angle be...
Hello, I have some product photos, from which I would like to remove the white background. An example: Is there a nice library or a manual way to do it with Cocoa or C? For which keywords (image processing methods) do I have to search? ...
I am well aware of the ugliness of this question, I'd still like to know if it's possible: When a program tries to read/write to an invalid pointer (NULL, unallocated block, etc') windows crashes the application with an access violation exception. The question is, is there a way to check wether this pointer will generate an exception b...
I've posted a question about validating a pointer's accessibility. The conclusion was either to use IsBadReadPtr to check the pointer, or SEH to catch the exception (and preferably to use neither, and debug the application, but that's not the issue here). IsBadReadPtr is said to be bad because, among other reasons, it would try to read ...
Hi, looking at the declaration for XDrawString from X11, it is int XDrawString(Display *display, Drawable d, GC gc, int x, int y, char *string, int length); How come the 6th argument is type "char *" instead of "const char *"? Does drawing the string require modifying it? I've seen lots of examples where people pass in...
It seems that strtol() and strtod() effectively allow (and force) you to cast away constness in a string: #include <stdlib.h> #include <stdio.h> int main() { const char *foo = "Hello, world!"; char *bar; strtol(foo, &bar, 10); // or strtod(foo, &bar); printf("%d\n", foo == bar); // prints "1"! they're equal *bar = 'X'; // seg...
If you have a good example of simply encrypting a file using openssl that is better than this one that I am having issues with I would be very grateful. Update: Myabe the author was correct. Using memset on something I did not allocate reminds me of strtok choking on non-stack variables. Update2: Got the core dump to stop by using m...
I have been working a year now as a software developer for a at the computer-vision department of a company. My main job is integration of third-party software into a framework, so i usually end up writing wrapper libraries because a lot of this third party software does not work the way we want it to work(not thread safe, pain in the a*...
If I have two binary trees, how would I check if the elements in all the nodes are equal. Any ideas on how to solve this problem? ...