Hi,
I want to create a custom malloc which allocates memory blocks within a given address range.
I am writing a pthreads application in which threads are bound to unique cores on a many-core machine. The memory controllers are statically mapped, so that certain range of addresses on main memory are electrically closer to a core.
I want...
I need to parse HTML fragments, by which I mean the files lack <html>, <head> and <body> elements, otherwise having well-formed XHTML syntax, UTF8 encoding guaranteed. It looks like libxml is ideal for this task, but I have certain constraints which I just don't know how to implement.
htmlSAXParseFile() does its job well enough, but it...
in a file, i have used m-x ucs-insert to insert a hex character 9e (which in emacs shows up as \236). however, when this is read in by the C program, 9e is becoming 0x9ec2. Where is this c2 coming from and how do i get rid of it??
...
Lately, I've been cleaning up some some C code that runs on an ARM7 controller. In some situations (upgrade, fatal error, etc...) the program will perform a reset. Presently it just jumps to 0 and assumes that the start-up code will reinitialize everything correctly. It got me to thinking about what would be the best procedure a la "Leav...
int main()
{
int a=10,b=20;
char x=1,y=0;
if(a,b,x,y)
{
printf("EXAM");
}
}
Hi, Please let me know why output of this question is "Printed Nothing"..
Thankss.
...
Hi,
I need to do an assertion based on two related macro preprocessor #define's declared in different header files... The codebase is huge and it would be nice if I could find a place to put the assertion where the two headers are already included, to avoid polluting namespaces unnecessarily.
Checking just that a file includes both exp...
Hi! all,
I have written a simple udp server which has to transmit certain data to few of it's clients.
but though server is successfully executing send,but unable to transmit even a single byte.The return value of send is 0 although I have enough data to be transmitted.you can see the code for the said server here: http://pastebin.com/ze...
A part of an application I'm working on is a simple pthread-based server that communicates over a TCP/IP socket. I am writing it in C because it's going to be running in a memory constrained environment. My question is: what should the program do if one of the threads encounters a malloc() that returns NULL? Possibilities I've come up wi...
in big while statement
if(tempc=='j') //i am creating array if before is not freeing
{ //if it filled with data just add another data in it
current=atoi(tutar[i+1])-1;
if(arrays[current]==NULL)//?? can should i do arrays[]==EOF or what
{ arrays[current]=malloc(sizeof(int)*4);
l_arrays[current]=calloc...
Our professor gave us the following assignment:
A "correct" series is one inwhich the sum of its members equals to the index of its first member.
The program is supposed to find the length of the LONGEST "correct" series within a series of n numbers.
for example: if the input series would be arr[4]={1, 1, 0, 0}
the output (long...
I'm trying to make a program with structs and files. The following is just a part of my code(it;s not the entire program).
What i'm trying to do is: ask the user to write his command. eg. delete John
eg. enter John James 5000 ipad purchase.
The problem is that I want to split the command in order to save its 'args' for a struct element...
I need to compute imaginary exponential in C.
As far as I know, there is no complex number library in C. It is possible to get e^x with exp(x) of math.h, but how can I compute the value of e^(-j), where j = sqrt(-1)?
...
Hello All,
I use EnumChildWindows to get all the Child windows from the main HWND window , But i would like to get only the first child of the given HWND window.
BOOL CALLBACK EnumChildProc ( HWND hwndChild, LPARAM lParam)
{
// logic to call only once
}
Is it correct ? or any other simple way ?
~UK
...
Hello, I'm making a program in C, and I'mm having some troubles with memory, I think.
So my problem is: I have 2 functions that return a struct. When I run only one function at a time I have no problem whatsoever. But when I run one after the other I always get an error when writting to the second struct.
Function struct item* ReadFile...
Hi there:
I have a question as described: how to perform rotate shift in C without embedded assembly. To be more concrete, how to rotate shift a 32-bit int.
I'm now solving this problem with the help of type long long int, but I think it a little bit ugly and wanna know whether there is a more elegant method.
Kind regards.
...
Hello.
I'm trying to develop a simple IRC bot. First I want to think out a proper design for this project. One of the things I'm wondering about right now is the read mechanism. I develop this bot on a Linux system. (Fedora 12) To read from a socket I use the system call "read()". I plan to use the reading functionality in the following...
I have a function irc_sendline that can be called like printf can
irc_sendline(s, "A strange game.\nThe only %s is not to play.", "winning move");
It works perfectly, but I'm not happy with its implementation:
int irc_sendline(irc *iobj, char *msg, ...)
{
char tmp_msg[BUFSIZE], fmsg[BUFSIZE];
va_list args;
int len;
va_st...
Hi. Somebody knows if it is posible to make a GtkCombo which allows multiple entries selection?In affirmative case how can i make this?
...
I read about the Microsoft specific suffix "i64" for integer constants. I want to do an UNsigned shift to a ULONGLONG.
ULONGLONG bigNum64 = 0x800000000000000i64 >> myval;
In normal C, I would use the suffix "U", e.g. the similar 32 bit operation would be
ULONG bigNum32 = 0x80000000U >> myval;
I do NOT want the 2's complement sign exte...
I have a struct named Game with an array of levels, defined like this:
typedef struct
{
Level levels[x];
} Game;
When I compile the code, if x is 1, 2 or 3, the program runs normally. If it's any other value (4, for instance), I get a segmentation fault. I'm not accessing the array anywhere. Main is something like this at the mo...