I've been tasked with porting an existing Windows GUI app to Linux. Ideally, I'd like to do this so the same code base can be used to build either the Windows version or the Linux version. I'll be doing my work on Ubuntu 9.04. After searching around, it's unclear to me what tools are best suited to help me with this.
A list of loos...
In another question i had the problem to port the code
unsigned long stack[] = { 1, 23, 33, 43 };
/* save all the registers and the stack pointer */
unsigned long esp;
asm __volatile__ ( "pusha" );
asm __volatile__ ( "mov %%esp, %0" :"=m" (esp));
for( i = 0; i < sizeof(stack); i++ ){
unsigned long val = stack[i];
asm __volatil...
Is there any way to force an alignment of a particular element of a struct using a GNUism?
...
typedef union YYSTYPE {
int64_t iConst; // constant value
float fConst; // constant value
int iAttrLocator; // attribute locator (rowitem for int/float; offset+size for bits)
int iFunc; // function id
int iNode; // node index
} Y...
Hi,
I have a function, which is called sometimes with regular, sometimes dynamic arrays.
If I define the function as
function_name(int[10][10] a)
and send int** as a parameter, I get a warning. Opposite, if I declare
function_name(int** a)
and send int[][] as a parameter (after casting) I cannot access to array elements inside fu...
I have been working on this problem for a while now.
I am trying to add JPEG support to a program with libjpeg.
For the most part, it is working fairly well, But for some JPEGs, they show up like the picture on the left.
Original Image
It may not be obvious, but the background shows up with alternating red green and blue rows. If any...
I noticed that it is a common idiom in C to accept an un-malloced pointer as a second argument instead of returning a pointer. Example:
/*function prototype*/
void create_node(node_t* new_node, void* _val, int _type);
/* implementation */
node_t* n;
create_node(n, &someint, INT)
Instead of
/* function prototype */
node_t* create...
I'm doing a steganography project where I read in bytes from a ppm file and add the least significant bit to an array. So once 8 bytes are read in, I would have 8 bits in my array, which should equal some character in a hidden message. Is there an easy way to convert an array of 0's and 1's into an ascii value? For example, the array: ch...
I have the follwing C function. How should I wrap it so it can be called from a Lua script?
typedef struct tagT{
int a ;
int b ;
} type_t;
int lib_a_f_4(type_t *t)
{
return t->a * t->b ;
}
I know how to wrapr it if the function parameter type were int or char *. Should I use table type for a C structure?
EDIT: I am usi...
Sorry if the question isn't correct, I'm very new in Objective-C.
I understand why this code throw the Warning: "warning: passing argument 1 of 'initWithObjectsAndKeys:' makes pointer from integer without"
NSDictionary *dictNames =
[[NSDictionary alloc] initWithObjectsAndKeys:
3, @"",
4, @"",
5, @"",nil];
Keys and Value...
I have a simple cpp file which uses GIO. I have stripped out everything to show my compile error:
Here is the error I get:
My.cpp:16: error: invalid conversion from ‘int’ to ‘GIOCondition’
make[2]: *** [My.o] Error 1
Here is the complete file:
#include <glib.h>
static gboolean
read_socket (GIOChannel *gio, GIOCondition condition, g...
So I've made a game in Python and PyGame. Now I'm interested in submitting the game to Intel's March Developer Challenge. However, the developer challenge requires use of Intel's Atom Developer SDK (http://appdeveloper.intel.com/en-us/sdk), which only has API's for C and C++.
I'm new to Python and PyGame, and have no experience in C or...
What is the best way to accomplish the following in C?
#include <stdio.h>
struct A
{
int x;
};
struct A createA(int x)
{
struct A a;
a.x = x;
return a;
}
struct A a = createA(42);
int main(int argc, char** argv)
{
printf("%d\n", a.x);
return 0;
}
When I try to compile the above code, the compiler reports th...
I have created a simple win 32 application..in which it has a textbox and a button in a dialog window..first when I created this..it didnt display the dialog window and then what I did is added the code below to handle the close(WM_CLOSE) of the dialog window...but I want to know, how to handle the button click event..
void ValidatePa...
I want to do something like that:
for (v=1;v=150;v++) {
for (h=1; h=250;v++) {
tile_0%i_0%i.image = [UIImage imageWithData:tmp_content_of_tile]; //1st %i = v; 2nd %i = h
}
}
In the %i should be inserted the current value of "v" or "h"? Is it possible? How is it called?
Greets!
...
I am developing a simple library in C, for my own + some friends personal use.
I am currently having a C structure with some members that should be somehow hidden from the rest of the application, as their use is only internal. Modifying by accident one of this members will probably make the library 'go wild'.
Is there any 'workaround'...
I am filtering the HKEYS by using Hook filtering function, I use the following code to disable Alt+Tab, Alt+Esc, Ctrl+Esc, Windows Key
if (((lParam.vkCode == 9) && (lParam.flags == 32))||
((lParam.vkCode == 27) && (lParam.flags == 32))||
((lParam.vkCode == 27) && (lParam.flags == 0)) ||
((lParam.vkCode == 91) && (lParam....
I'm writing a C++ plugin in Mac OS X using the Carbon framework (yeah, yeah, I know, Apple is deprecating Carbon, but at the moment I can't migrate this code to Cocoa). My plugin gets loaded by a master application, and I need to get a CFBundleRef reference to my plugin so that I can access it's resources.
The problem is, when I call C...
Hi, I was wondering how you could take 1 string, split it into 2 with a delimiter, such as space, and assign the 2 parts to 2 separate strings. I've tried using strtok(); but to no avail.
Thanks!
Mr. Man
...
I have the following problem:
"list.c"
struct nmlist_element_s {
void *data;
struct nmlist_element_s *next;
};
struct nmlist_s {
nmlist_element *head;
nmlist_element *tail;
unsigned int size;
void (*destructor)(void *data);
int (*match)(const void *e1, const void *e2);
};
/*** Other code ***/
What will b...