c

Struct Scope Access

Hi this a continuation of a previous question I asked however I wasn't registered then and thus cannot edit the question. Anyways I have a struct typedef struct { char input[100][100]; int count; char name; int startTime; }INPUT; extern INPUT *global; this is within the header file. A stackoverflow member suggested that in my sou...

How to USE external C functions in Objective-C with UITextField and UITextView ;-)

Hello, Again I'm trying to wrap my head around Objective-C and Cocoa. So I've posted some code below. What I'm trying to do is basically use the function "th_brk_line" by entering text into a UITextField then displaying it into a UITextView once it has been processed by "th_brk_line". I've posted the external function definition and the...

Tab control like in FireFox in native windows app

Hello, I would like to enable tabbing for my application. And so far it seems I could use a tab control. The problem with it is, though, that it creates a border around the client area. What I want, is more like a FireFox tab control, that only takes up a row in the application and doesn't create any frames around client area. Does any...

C or C++ for pattern recogniton/image processing?

I about to take some courses in Pattern Recognition. As i have no prior knowledge in either C or C++, my professors told me to learn a bit of one of them before the course, and learn more when doing the course. Which one should i pick? The prior knowledge in programming i have is limited to mostly C# but some PHP, SQL and Prolog as wel...

started from command line?

Hi, I have a simple C/CPP process running on a linux system. This is a.out. Another process is capable to start a.out inside its code. This is b.out. What code do I need inside a.out to understand that it is executed from the command line? Eg ./a.out Is there a way a process to know if it started from the cmd or started from another ...

Code reviewing help needed. (audacious) (C)

static void do_write (void * data, gint samples) { void * allocated = NULL; samples = flow_execute (get_postproc_flow (), 0, & data, sizeof (gfloat) * samples, FMT_FLOAT, effect_rate, effect_channels) / sizeof (gfloat); if (data != allocated) { g_free (allocated); allocated = NULL; } apply_...

unsigned long long to string convert

Hi! I try to convert unsigned long long to string like this unsigned long long Data = 12; char Str[20]; sprintf(Str, "%lld",Data); when i want to see but i always see 00 Str[0],Str[1]....; whats the wrong !!! ...

p89lpc936 keil programming help required.

Hello all, I am trying to program Blinky program from Keil complier to P89LPC936 microcontroller through a universal programmer(SuperPro). But the microcontroller is not running. But when i write a simple program in assambly and program the same hardware it works fine. Please I need help regarding it where i am doing wrong. Here is cod...

Calculate the fibonacci numbers in multiprocess way ?

I am writing multi process fibonacci number calculator , I have a file that keeps track of the fibonacci numbers , first process open the file and write first fibonacci numbers (0 and 1 ), then do fork and its child process read the last two numbers add them up and write the next into file and close the file and fork again this process c...

C : is there "lazy evaluation" when using && operator, as in C++ ?

Hello, i would like to know if this looks correct : while((next !=NULL) && (strcmp(next->name, some_string) < 0) { //some process } i mean, if next is NULL, then the second part of the expression won't be ever tested by the compiler ? i have heard that in C++ it's the case (but i'm not even sure of it). Can someone confirm me th...

Is i = 0, ++i defined ?

I recently learned about the , operator and the fact that it introduces a sequence point. I also learned that the following code led to undefined behavior: i = ++i; Because i was modified twice between two sequence points. But what about the following codes ? i = 0, ++i; i = (0, ++i); While I know the rules, I can't get to a conc...

Trying to study MPEG Layer-III encoder - getting "expected '=', ',', ';', 'asm' or '__attribute__' before" errors

Greetings. I am studying the way mpeg layer-III encoding works for an upcoming project. I downloaded the shine encoder as it is said to be the simpliest of all. http://www.mp3-tech.org/programmer/sources/shine.zip is the link. My current step that i FAIL at is to compile the source codes i downloaded. I never before worked on a lower ...

Multithreading UDP server with epoll?

Hi all, I'd like to develop a multithreaded UDP server in C/Linux. The service is running on a single port x, thus there's only the possibility to bind a single UDP socket to it. In order to work under high loads, I have n threads (statically defined), say 1 thread per CPU. Work could be delivered to the thread using epoll_wait, so thre...

Array wraparound with modulo of unsigned

I'm trying to implement a lagged Fibonacci pseudo-random number generator for integers up to some maximum. It maintains an array of values int values[SIZE] = { /* 55 seed values */ }; and uses the following function to return the next value unsigned lagfib() { static unsigned idx = 0; int r = values[idx]; /* The followin...

printf too smart casting from char to int?

Why does the following call: printf("%d %d", 'a', 'b'); result in the "correct" 97 98 values? %d indicates the function has to read 4 bytes of data, and printf shouldn't be able to tell the type of the received arguments (besides the format string), so why isn't the printed number |a||b||junk||junk|? Thanks in advance. ...

Arrays are Pointers??

Possible Duplicate: Is array name a pointer in C? Are arrays and pointers implemented differently? I have come across this question because , in both the cases we access elements from the starting address of an element.So , there should be close relation between them . Please explain the exact relation between them . Thanks. ...

Trying to study shine MPEG Layer-III encoder - getting "redeclaration of C++ built-in type 'bool'"

Greetings. I am studying the way mpeg layer-III encoding works for an upcoming project. I downloaded the shine encoder as it is said to be the simpliest of all. http://www.mp3-tech.org/programmer/sources/shine.zip is the link. I successfully compiled them in a standalone project but i need to be using them in a QT project. I made new ...

Swap nodes in a double linked list - slow sorting algorithm drops nodes

For practice, I've been working on a compressor which does the find-repeated-parts, make-dictionary, compress-with-huffman codes thing. It's not really working. One of the problems is, for some reason my sorting algorithm drops keywords from the dictionary. I think the problem is in the swap routine, but I'm not sure. ( this routine ...

How much data can be malloced at a time? what is the limit in modern OS such as Linux?

Hi, How much data can be malloced and how is the limit determined? I am writing an algorithm in C that basically utilizes repeatedly some data stored in arrays. My idea is to have this saved in dynamically allocated arrays but I am not sure if it's possible to have such amounts malloced. I use 200 arrays of size 2046 holding complex dat...

Requesting complete, compilable libxml2 sax example.

I'm having a heck of a time figuring out how to use the sax parser for libxml2. Can someone post an example that parses this XML ( yes, without the <xml...> header and footer tags, if that can be parsed by the libxml2 sax parser): <hello foo="bar">world</hello> The parser should print out the data enclosed in element hello and also g...