server: i make a listen with 5 backlog
and then a newfd= accept...
several clients can connect several times, trade messages and shutdown (after closing newfd)
the problem is that if the...
Type: Posts; User: Ironic
server: i make a listen with 5 backlog
and then a newfd= accept...
several clients can connect several times, trade messages and shutdown (after closing newfd)
the problem is that if the...
pretty much as i am doing. just hoping to find a better way. tks anyway
i need to delete several files at one without knowing how many are there.
but they all start with :f ile
ex:
file001
file007
file010
etc
problem solved. had a mistake somehere else
tks
i´ve even tried the edited version of code above. same thing happens
exert from code: (just the essencial)
fd_set fdset,fdsetbck;
FD_ZERO(&fdsetbck);
FD_SET(sfd,&fdsetbck);
(sfd is a tcp sockect, after listen instruction)
while(1){
...
problem solved. thanks
fp is 0x7
i can even read from the file
but as soon i hit fseek it crashes...
fp=fopen(blkname,"rb");
also tried this. same error
with fopen, fp gets the same result
in both cases if i do fileno(fp), it crashes, but don´t why or how to fix it.
i assume you forgot a "," between o and seek: fseek(f, 0 SEEK_END);
i've tried that method but get a Program received signal SIGSEGV, Segmentation fault., in the fseek line
FILE *fp;...
I´ve tried stat to get the file size of a certain file.
When i run debugger i can see the st_size field with the desired size, but i cant copy it to any other variable. i´ve tried copying to int,...
dwks's suggestion worked fine.
tks
i have also tried writer | reader ,(writing to stdout), but the behavior is strange .
The messages are not delivered at the same speed as when the program writer is runned alone.
Some are...
I have a program that reads and executes commands from user.
To test it well i was planning to write several commands in a text file and them send those commands one by one to the program.
...
tks, maybe the problem is that data is still in stdin.
How can i delete remaining data in stdin, if fgets doesn read all the bytes itś supposed to?
usual fflush(stdin) doesn't work...
yes.
That is not the problem. What i think is that when the printf is executed, the \n at the end of it, simulates the uses pressing enter, so it reads without anything been typed...
By what i have read, fgets is the best and safest way to read a string from the user.
The problem is that my program has a thread where a printf is executed. Is seems the \n at the end of the...
thank you
Title pretty much covers it.
I have a program with a variable number of childś writing to the same pipe, from witch the father reads.
Is this dangerous? can data be corrupted if execution jumps...
i am sure that the father only sends one message.
I have a infinite cycle in child in which it i read from pipe, and type out number of read bytes and the message.
in the 1st cycle it prints...
I use a pipe to send an int from father to child.
I write in father, and use read in child.
I thought that when i read from the pipe it becomes empty, so i do another read to wait for a second...
the use of signals is good because they dont take up any resources like a pipe when it is not beiing used.
but the problem is that a signal generates an interrupt. it halts current execution,...
the problem is that signals are slow , because they generate interrupts. if i had to send many commands i would slow down a lot.
What do you mean?
In my pc it creates about 8000 children. It's slow but it works.
But the point of this, is what would be more efficient for larger numbers, and with a lot more powerful...