hi there. i've got a problem: sometimes (not regularly) recv returns -1 and errno == EAGAIN while using epoll in edge-triggered mode. piece of code:
server_sock = startup(&port);
if ( (epollfd = epoll_create(4096)) < 0) {
perror("epoll_create error");
exit(EXIT_FAILURE);
}
ev.events = EPOLLIN | EPOLLET;
ev.data.fd = server_soc...
During the course of my program,
I pass the output of an execv() to a file, for logging, (using the outCopy() function)
and then print it back on screen to simulate stdout output. (using the printFile() function)
The 2 functions are:
void printFile(char *fileName)
{
char *fileContent=(char *)malloc(200*sizeof(char)); ...
Hi,
I'm trying to send a lot of data(basically data records converted to a string) over a socket and its slowing down the performance of the rest of my program. Is it possible to compress the data using gzip etc. and uncompress it at the other end?
...
This is actually part of a project I'm working on using an avr. I'm interfacing via twi with a DS1307 real-time clock IC. It reports information back as a series of 8 chars. It returns in the format:
// Second : ds1307[0]
// Minute : ds1307[1]
// Hour : ds1307[2]
// Day : ds1307[3]
// Date : ds1307[4]
// Month : ds1307[5]
// Yea...
Hi,Are there some good books or articles about file processing with c/c++, especially when the file is very large, GB or something like that?
...
typedef struct car car_t;
struct Car {
int carID[QUEUE_SIZE];
int f[QUEUE_SIZE];
};
int main (){
int Array[ARRIVAL_QUEUE_SIZE];
car_t *ddd = (car_t*)malloc(sizeof(car_t));
for(int i =0; i<2; i++){
int carid = ((CARID_NUMBER_MIN)+(int)((double)(NUMBER_MAX-NUMBER_MIN+1)*rand()/(RAND_MAX+1.0)));
Array[i] = carid;
dd...
I'm having some problems trying to run this program I am working on...The requirements say I was not allowed to use a sort function...I had do something myself....etc.
Pretty much, the program compiles but hangs after executed...I'm guessing it's stuck in an infinite loop...but I can't seem to find it... :(
This program reads to data f...
Hello guys,
I am unable to figure out the exact difference between character devices vs Terminal devices vs Streams. Any help is very much appreciated.
Thanks & Regards,
Mousey.
...
I'm writing a xenomai applications which spawns a few threads:
rt_task_spawn(&fcThread, "fcThread", FC_THREAD_STACK, FC_THREAD_PRIO, 0, &run, (void*)(this))
Each thread is very simple and looks like this:
while (true)
{
rt_queue_read(pThis->pMsgQueue, (void*)(&msg), sizeof(mystruct), TM_INFINITE)
…
}
They are simple threads but...
int main(){
int right[2][3] = {
{1,4,6}, {2,7,5}
}
....
calc(right);
}
int calc(int ** right){
printf("%i", right[0][0]);
}
I calc function that calculate some numbers based on a matrix, but I dont' know why i get seg fault when I access the variable right within the calc function. does any body know the s...
Does anyone know how could I find out which are cl.exe's builtin/predefined macros?
For example for gcc the following command line will list all the compiler's builtin macros
gcc -dM -E - </dev/null
EDIT: I'm interested in a way similar to gcc's that is "ask the actual compiler".
Thanks
...
In c you can do
shmid = shmget(SHMEM_KEY, sizeof(int*) * n , SHEMEM_MODE | IPC_CREAT);
int* shmem = shmat(shmid, NULL, 0);
to assign first given free memory space as a shared memory.
Is there any way to assigne current memory space as a shared memory?
...
Hi,
I am a beginner when it comes to Socket Programming. I am currently trying to develop a web server that can service basic GET and POST http requests from a browser. I am using my laptop as the server and the client both. So the idea is that I should be able to type http://127.0.0.1:PORT/ in Firefox and my web server should be able t...
If I use the macro:
#define AND
in the following way:
if(...)
{
...
}
elseANDif(...)
{
...
}
What output does the preprocessor produce?
Edit:
I intend to use:
#define TEST(params) if(...){...}else
the ... in if(...) is a complicated expression using params
the ... in {...} performs some operations & is independent of param...
I have an application (the source for which I don't have), which can be invoked from command line like this
$ ./notmyapp
I want to know all the locations where the application is writing to. It outputs some files in the directory it is being called from, but I need to make sure that those are the only files that are created.
So, I ne...
I make a structure just like
struct abc {
//any function or variable
} obje[20];
now I want that the each object of abc store in array. means that arr[0] contain obj[0] only; can it is possible. if it is possible then some one help me in this matter.
...
GDB normally stops all threads if a breakpoint is reached (or Ctrl+C is pressed in the GDB shell). I'm aware that commands like scheduler-locking and schedule-multiple exists, but I see no possibility to let a defined thread run in the background while another is debugged.
...
Hi is there anyway to write a c program without main function.If so,point it out plz!
...
Hi,
Initially...
I started programming in C. that was was 10 years back(college). The IDE i used was Turbo C++ IDE.
All my c programs were 16bit.
Memory Model : Huge.
Graphics : 4bit (16 colors).
Graphics Driver: EGAVGA.BGI
Resolution: 640x480.
OS: MS-DOS 6.0 (under windows98 it is 7.0 - which always gave an accelerated execution of...
Hi,
I have just come to Mac world from Linux world and I love my way around in Mac environment. I want to write and practice simple C programs in mac and I was searching for the tools I require. Most (All) of the resources in the web ask me to use XCode as IDE to do programming in C on Mac. XCode, for my purpose seems to be an overkill....