do I have to use a bash script for this?
also if I want the sorting to be according the second field (the float) how can I achieve that with one command?
Type: Posts; User: quo
do I have to use a bash script for this?
also if I want the sorting to be according the second field (the float) how can I achieve that with one command?
hello everyone!
I have a file which has records with 2 fields--one int and one float---
what is the best way to sort it?
The sorting has to be based on the int field(the first field)
(each time...
hello everyone
I have a stupid question.When I have allocated a
char* a;
to point to an array of chars.And then I want a
Thank you guys for your answers!I will try both methods!
Thank you for your answer.I have never used that before and although I googled it I couldn't quite understand how it's working..
Could you please give me a simple example?
I was wondering if I have a declaration such as:
#define worker_id1 2311
and at some point of my program I want to print
worker_id1
hi guys
what I want is to create a file only if it doesn't exist otherwise if the file exists I want to print an error.Also an error has to be returned if the creation of the file was...
Thank you for your answer.So if I do what you suggest then I do not need to do this as well for every object right?
a[i] = (A *) malloc (sizeof(struct A));
This is what I did for...
Ok thank you I think I've understood now.
I have one more question
When it comes to arrays and I want to allocate an array of structs then how should I do it ?
Like this:
struct A **a =...
Yes I must have been a bit confused..No I certainly want a list of elements.
So for a list how should I initilize it?
hi guys i'm having the following problem with my code.
I have a struct that represents a list :
struct list_of_elements{
int number_of_elements; //counter of list elements
A*...
hi guys
I have a C program where I need to write to a socket a char*
In fact I have a char* message
char* message = "things to be read";
if(write(sockdes,message,sizeof message)<0)
...
thanks that was useful!
what if I want after printing the contents of the buffer to restore new stuff in there?
I can do:
i=-1
all over again,but maybe the second time the data will not...
hi guys
I have a program where I read data char by char and store them into a buffer.Every byte I read I want to put it in the buffer so I do this:
char buf[128];
char c;
//read one char...
yes you're right!thanks
hi all!
I have a c program and at some point I do:
void *a;
allocate(&a);//function that allocates a pointer--this works ok
memcpy(&b,a+25*sizeof(c),sizeof(int));//c is a struct
the...
well,how can I use that?
could you give me an example?
the use of sed in order to cut the string when the substring .php is met is not an option?
hello all
in my bash script I have some strings that I want to cut up to a specific substring.For example
www.something.com/dir1/some.php?id=1&ll
and I only want to keep the link up to...
actually I just realized that the child after the signal handler function returns to the main function and inside the loop(as it was already inside when it caught the signal)
but blocks there...
thank you guys for your help,actually it was very confusing the way I was trying to do it when it came to many child processes so I changed it and used 2 fifo pipes one to send and one to receive...
I tried it as you suggested and a strange thing occured..
In the child process there's the loop:
while(!c1){
//do things--I removed sleep()--
}
once the child is alive it runs this...
Thank you very much for your answer.There're just a few things I don't understand,if you could explain to me
First,what is the use of the volatile int?(Never seen that again before:))
Secondly,what...
I just figured that the problem must be here:
waitpid(pids[i],&status,0);
The parent sends the signal to the first child and receives the answer,executes its function which handles the signal...
I am supposed to do send signals both directions,is not actually my choice
The parent when it has finished everything it has to do sends the signal REQ to all children and when they catch it they...
I have a parent process and many children.
The childrens' pids are stored in an array of ints.
at some point of the program I want to send a signal to all the children from the parent process and...