Forum: Python Jul 14th, 2008 |
| Replies: 1 Views: 438 data = unpack('>L', sock.recv(4))
Does this line of code means, incoming data is big endian and so unpack to endianess of local machine and assign to data. If local machine is little endian,... |
Forum: Python Jun 23rd, 2008 |
| Replies: 0 Views: 1,221 I would like to convert url into md5 hash. My question is that md5 hash will create collision at 2^64. If you do long(value,16), where value is the md5 hash string, would value returned from... |
Forum: C Dec 27th, 2007 |
| Replies: 30 Views: 3,266 I got it to work. Whoo hoo! Salem, you're C SuperMan. Thanks. |
Forum: C Dec 27th, 2007 |
| Replies: 30 Views: 3,266 Salem, in the above code you do: (pid_t)-1, what does this do? Type cast the -1 to pid_t?
Can I run fork in a function other than main? Many example on google show it main.
Can I do parent... |
Forum: C Dec 27th, 2007 |
| Replies: 30 Views: 3,266 On the linux terminal, I changed the permission to 770 and gunzipped. Bar contents looks good. And the permisson T disappears after chmod 770. I will quote this from this site: capital T sticky... |
Forum: C Dec 27th, 2007 |
| Replies: 30 Views: 3,266 > There are some very strange permissions on those files. Have you been messing with the umask() function?
I didn't play with umask()
I just cut and pasted it and complied with gdb option and ran... |
Forum: C Dec 27th, 2007 |
| Replies: 30 Views: 3,266 I ran it. But I have problem with the output file. I can't gunzip it. I changed bar.zip on the second run to bar.gz. What is cap T in permission for the file?
--wx-wx--T 1 jobs jobs 432940... |
Forum: C Dec 26th, 2007 |
| Replies: 30 Views: 3,266 How I can get the gzipping: execl("/bin/gzip","/bin/gzip","-c","../data/data_.txt",">","./data/data.gz",0);
to work from a C-program?
I understand it now.
I am just using default Eclipse CDT... |
Forum: C Dec 26th, 2007 |
| Replies: 30 Views: 3,266 When I run this, I get funny characters displayed continuously on my shell.
Here is my programA code:
#include <syslog.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>... |
Forum: C Dec 25th, 2007 |
| Replies: 30 Views: 3,266 If I am only forking one process in progA and no forking in progB(just execl in method main), any reason why I need to worry about this? |
Forum: C Dec 25th, 2007 |
| Replies: 30 Views: 3,266 Can you tell me how you do this?
For execl():
execl();
_exit(EXIT_FAILURE);
For wait() am not so sure how to do this. |
Forum: C Dec 25th, 2007 |
| Replies: 30 Views: 3,266 If I put something below the closing } of if(pid==0), does it get executed in parent or both?
eg: while() condition and any code below while condition should only be executed by the parent. |
Forum: C Dec 25th, 2007 |
| Replies: 4 Views: 1,586 It worked. Placing (char*) in front of 0 makes it into a NULL character? |
Forum: C Dec 25th, 2007 |
| Replies: 4 Views: 1,586 I am getting an error when I do this in C program:
execl("/bin/cp","../data/data_.txt","../data/data.txt",0);
error is as follows:
../data/data_.txt: missing destination file operand after... |
Forum: C Dec 25th, 2007 |
| Replies: 30 Views: 3,266 pid = fork();
if ( pid < 0 )
{
syslog(LOG_ERR,"Cannot fork!!");
exit(1);
}
if ( pid == 0 )
{ /* Child process */
execl("./myprogB",0); |
Forum: C Dec 24th, 2007 |
| Replies: 2 Views: 11,798 thank you, that helped.
Merry Christmas |
Forum: C Dec 24th, 2007 |
| Replies: 30 Views: 3,266 What if you want A to wait until B completes? |
Forum: C Dec 24th, 2007 |
| Replies: 2 Views: 11,798 int file
file = open("./some.txt", O_RDONLY);
Above line file=open giving me compile error:
'O_RDONLY' undeclared (first use in this function)
What is the problem here?
I am running... |
Forum: C Dec 24th, 2007 |
| Replies: 11 Views: 3,084 Line by line I need to get the whole content in a line from a file. I have looked at fgetc, fgets. According to fgets, I need to specify max number of characters to read.
If I have file content... |
Forum: C Dec 24th, 2007 |
| Replies: 5 Views: 2,906 strcpy(buf, "my_id_%d_",i)
strcpy(buf1, "my_com_id_%d", j)
First I want to place value of i into "my_id_1" like so and copy to buf. And do the same thing in second line the code. Now I want to... |
Forum: C Dec 21st, 2007 |
| Replies: 6 Views: 1,050 When you read file in C and move to next line and so on. This seems you have to access file top to bottom sequentially without skipping lines.
I need a way to read very 5th line or something... |
Forum: C Dec 21st, 2007 |
| Replies: 5 Views: 1,338 I have a config file which includes how many files I need to create. So my program reads the config file and will create those files. Where I am stuck is I do not know before hand how many File... |
Forum: C Dec 21st, 2007 |
| Replies: 3 Views: 4,179 I have a file pointer which was assigned in main. In the main, I just open a file to write stuff to it. I want to pass the file pointer to several functions so that they can write to the file. In... |
Forum: C++ Dec 20th, 2007 |
| Replies: 1 Views: 3,812 I am looking for a good C++ example of a simple MySQL client program written in C++ and runs on Linux, using MySQL++ libraries that does the following (no threading):
Accessing Option File... |
Forum: C Dec 20th, 2007 |
| Replies: 2 Views: 2,059 char stmt_buf[1024], buf[(1024*2)+1];
stmt_buf ="SELECT id, title FROM post LIMIT 5;";
I get an error:
connect2.c: In function ‘main’:
connect2.c:217: error: incompatible types in assignment |
Forum: C Dec 20th, 2007 |
| Replies: 4 Views: 2,325 If you want to mail it to multiple people would you do it this way? |
Forum: C Dec 20th, 2007 |
| Replies: 5 Views: 6,993 What is the different with have no * inside sizeof(), eg sizeof(int), vs sizeof(int *)? |
Forum: C Dec 19th, 2007 |
| Replies: 4 Views: 2,325 I am running linux. This problem maybe implemented many times over. I am not hitting right google search term. I need a way to send email from my c program, if that program fails to excute some... |
Forum: C Dec 19th, 2007 |
| Replies: 30 Views: 3,266 I am using Linux Fedora, gcc 4.1.2-14.
My problem is, ProgramA starts and don't know how long and when it will finish executing. But ProgramB depends on the file ProgramA creates. Easy way to... |
Forum: C Dec 19th, 2007 |
| Replies: 30 Views: 3,266 I have a CProgramA that need to call CProgramB just before CProgramA terminates. How can this be achieved? |
Forum: C Dec 17th, 2007 |
| Replies: 1 Views: 2,008 Part 1:
I found this on the internet. I have a question about the above quote where they mention there could be situation in which "no clock is available".
What do they mean by no clock... |
Forum: C Dec 17th, 2007 |
| Replies: 8 Views: 2,325 I just want pass it to syslogd to do the logging in a separate file. |
Forum: C Dec 16th, 2007 |
| Replies: 3 Views: 697 Can someone tell me what value would each of the line of code will have, when you go through this code:
Here is the full code:
server.conf:
interface=192.168.0.2;
log=/var/log/example;
... |
Forum: C Dec 16th, 2007 |
| Replies: 8 Views: 2,325 I have a C program I am writing and need this program to write to syslog and have the logs in a separate file for my program.
Eg. My program is called "example.c", then I want to have a log file... |
Forum: C++ Dec 16th, 2007 |
| Replies: 4 Views: 800 I read the doc on read, but read only takes two arguments not three in this case. |
Forum: C++ Dec 15th, 2007 |
| Replies: 1 Views: 2,964 I need to create a program and have it create a lock file so that only one instance of the program can be run at any one time.
I came across this code:
for (tries = 0; tries != maxtries;... |
Forum: C++ Dec 15th, 2007 |
| Replies: 4 Views: 800 I am looking at the code which has the following:
read(conf_fd,conf,100);
Can someone tell me what these parameters are passed to read function? |
Forum: Python Nov 4th, 2007 |
| Replies: 1 Views: 1,745 What and when you would use Decimal vs Float Type? |
Forum: Python Nov 4th, 2007 |
| Replies: 3 Views: 1,400 How do you compare two decimal numbers in python? |
Forum: Python Oct 21st, 2007 |
| Replies: 3 Views: 5,534 What is the best way to eliminate duplicates in list using sets, if you can perserve the order, it will be good? |