I want to make a GUI for a game coded in C for Linux Platform.Are there any API`s to do this or what woulb be the easiest way to make a gui.
...
The code segment given below compiles and when run gives the result as :
$ make
gcc -g -Wall -o test test.c
$ ./test
string
/* code1 */
#include<stdio.h>
char *somefunc1()
{
char *temp="string";
return temp;
}
int main(int argc,char *argv[])
{
puts(somefunc1());
return 0;
}
whereas a slight modification to this code gi...
I need to print the name of functions which is already stored in a function pointer.
Eg.
preValidateScriptHookFunc = (srvScrGenFuncPtrType)SRV_VerifyPymtOrderMaintDtls_validate_data;
I want the value "SRV_VerifyPymtOrderMaintDtls_validate_data" as output during program run via preValidateScriptHookFunc.
preValidateScriptHookFunc is a f...
As part of my Uni course we've been shown and asked to use pipes to communicate between processes (using pipe() and fork()) for a few small exercises. No problems getting it to work or with the concept, but outside of these requirements I'm wondering how efficient it is to write and read with a pipe of this type?
If I've some value that...
I'm trying to understand how asynchronous file operations being emulated using threads. I've found next-to-nothing materials to read about the subject.
Is it possible that:
a process uses a thread to open a regular file (HDD).
the parent gets the file descriptor from the thread, now it may close the thread.
the parent uses the file de...
#include<stdio.h>
int main(int argc,char *argv[])
{
int i=10;
void *k;
k=&i;
k++;
printf("%p\n%p\n",&i,k);
return 0;
}
Is ++ is legal operation on void* ? Some books say that it's not
but K & R doesn't say anything regarding void * arithmetic ( pg. 93,103,120,199 of K &R 2/e)
Please clarify.
PS : GCC doesn't comp...
I am pulling data from a bzip2 stream within a C application. As chunks of data come out of the decompressor, they can be written to stdout:
fwrite(buffer, 1, length, stdout);
This works great. I get all the data when it is sent to stdout.
Instead of writing to stdout, I would like to process the output from this statement internally...
I have a process master that spawns N child processes that communicate with the parent through unnamed pipes. I must be able to:
make the father open the file and then send, to each child, a struct telling that it has to read from min to max line;
this is going to happen at the same time, so I don't know:
1st how to divide total_lines ...
BALL ball1;//,ball2,ball3;
ball1.bx = 0;
ball1.by = 0;
ball1.bvx = 1.0;
ball1.bvy = 1.0;
ball1.radius = 5.0;
BALL is a struct in a separate.h file where I have used the following code :
typedef struct ball
{
GLfloat bx;
GLfloat by;
GLfloat bvx;
GLfloat bvy;
GLfloat radius;
}BALL;
typedef struct paddle
{
GLfloat length;
GLfloa...
int main ()
{
int * b;
b = (int*) malloc (1);
*b=110000;
free (b);
return 0;
}
Why heap corruption happens at free (b);?IMO heap corruption already happens at *b=110000;,what do you think?
...
I've got some C functions which I am calling through JNI which take a pointer to a structure, and some other functions which will allocate/free a pointer to the same type of structure so that it is a bit easier to deal with my wrapper. Surprisingly, the JNI documentation says very little about how to deal with C structures.
My C header...
I have heard the term before and I would like to know how to design and code one.
Should I use the STL allocator if available?
How can it be done on devices with no OS?
What are the tradeoffs between using it and using the regular compiler implemented malloc/new?
...
hi need to print this in c
1
2 1 2
3 2 1 2 3
4 3 2 1 2 3 4
...
Example =
#define a 100
#define b 200
main()
{
int c=a+b;
}
After preprocrssing
Output-
#define a 100
main()
{
int c=a+200;
}
...
This scanf should always return true until I input none numeric input, but this scanf never executes while loop. Why?
Sample input:
10.0 5.0
Press [Enter] to close the terminal ...
Code:
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char** argv)
{
float a, b;
while ( scanf("%f %f", &a, &b) == 1 )
{
p...
I use a random function(Let's call it randomNum()) to generate random numbers(unsigned long) continuously(will generate about one million numbers in total).My question is How to determine whether the frequency of current number generated is greater than 20%(among the total numbers generated so far) efficiently?
Please write down your op...
Possible Duplicate:
C programming : How does free know how much to free?
When we are allocating some memory from the heap using mallolc or calloc or even realloc, we are giving the pointer and the size of the memory which we want to allocate. But while freeing that allocated memory, we are providing only pointer (base address ...
Question:
How to (where to find additional information i.e., examples) programatically create a pseudo device-node under /dev from a kernel module?
...
I have a
char** color;
I need to make a copy of the value of
*color;
Because I need to pass *color to a function but the value will be modified and I cannot have the original value to be modified.
How would you do that?
The whole code would look like this
Function1(char** color)
{
Function2(char * color);
return;
}
I have...
hi. guys
i have experienced a weird thing today.
i am installing tomcat5 , and it stopped in the middle of progress bar. and i use process explorer to check the processes. i found a process with command line :
C:\TEMP\nse305.tmp\ns306.tmp "C:\Program Files\Apache Software Foundation\Tomcat 5.0\bin\tomcat5.exe" //IS//Tomcat5 .....
the w...