12-30-2004
I am pretty sure gen_log() is not modifying "line". It is a generic fn. we use in most of our applications for generating error logs. I have tested it. It is not modifying "line".
10 More Discussions You Might Find Interesting
1. Programming
i have made a ftp application in socket programming which uses TCP/IP .. i have the problem runing the only problem is on the client side i take the user input for the file to be downloaded from the command promt.
write(s, argv, strlen(argv)+1); // this is how i write in client side
argv is... (1 Reply)
Discussion started by: toughguy2handle
1 Replies
2. UNIX for Advanced & Expert Users
I have a large file with the first 2 characters of each line determining the type of record. type 03 being a subheader and then it will have multiple 04 records.
eg: 03,xxx,xxxx,xxxx
04,xxxxxxxxxxxxxxxxxxxxxxxxxxxx
04,xxxxxxxxxxxxxxxxxxxxxxxxxxxx
03,xxx,xxx,xxx
... (2 Replies)
Discussion started by: badg3r
2 Replies
3. Shell Programming and Scripting
Im trying to execute the below command on our server to list files and replace the newline in the file list with spaces, but the character 'n' is getting replaced with a space, is there any environment variable that needs to be set in UNIX?
sh -c 'ls -trx... (1 Reply)
Discussion started by: rameshrr3
1 Replies
4. UNIX for Advanced & Expert Users
Hi Gurus,
I tried FTP one file to UNIX which got values like
wel^come
If I see the content in unix, it shows like
wel^Zcome
^ coverted into ^Z (Control + Z )
Can someone please share what is happening here?
Thanks,
Shahnaz (5 Replies)
Discussion started by: shahnazurs
5 Replies
5. UNIX and Linux Applications
I have been using firefox3.5 now for some months and noticed that some images, notably in the png format, do not display correctly: the images are not displayed at all or display in part whereby the rest of the image shows a black rectangle. Does anybody else suffer from this problem?
Desktop:... (0 Replies)
Discussion started by: figaro
0 Replies
6. Red Hat
I have two servers on same domain. one can nslookup other cannot
Psu100 can lookup to psu000, psu010 & psu011
Psu110 can NOT lookup to psu000, psu010 & psu011
I verified resolv.conf entries on both psu000 and psu010 and it contains both name servers (10.200.10.21 & 10.200.11.22).I am... (1 Reply)
Discussion started by: scorohan
1 Replies
7. Programming
Hello.
During the holidays I've been developing an application on my desktop computer at home.
I setup a repository on github, so when I got back to work I cloned the repo to my laptop.
It wouldn't work.
The app is comprised of a client and a server, strangely enough the server would segfault... (10 Replies)
Discussion started by: erupter
10 Replies
8. Shell Programming and Scripting
Hi,
Immediate help on below will be appreciated.
I have to read a file (max of 10MB) which will have no new line characters, i.e. data in single line. and have to inster '\n' at every 100 characters. and if record starts with 'BUCA' then need to pick value of length 10 at position 71 and... (7 Replies)
Discussion started by: maks475
7 Replies
9. UNIX for Advanced & Expert Users
Can anyone explain why wc is behaving weirdly? Their are only 2 occurrences but wc thinks their are 7 occurrences. I have even manually checked this.
$ grep -i base *
lit: base xx
lit.lst:003- 00103 BASE XX
$ grep -i base * | wc -w ... (2 Replies)
Discussion started by: cokedude
2 Replies
10. Shell Programming and Scripting
I have been trying to use read in a script with issues so I tried some things on the command line.
$ echo "testing 123" | read x ; echo $xand
$ echo "testing 123" | read -r x ; echo $xare only producing any output after being invoked the first time after rebooting the machine. I also got into... (14 Replies)
Discussion started by: Michael Stora
14 Replies
LEARN ABOUT REDHAT
pclose
POPEN(3) Linux Programmer's Manual POPEN(3)
NAME
popen, pclose - process I/O
SYNOPSIS
#include <stdio.h>
FILE *popen(const char *command, const char *type);
int pclose(FILE *stream);
DESCRIPTION
The popen() function opens a process by creating a pipe, forking, and invoking the shell. Since a pipe is by definition unidirectional,
the type argument may specify only reading or writing, not both; the resulting stream is correspondingly read-only or write-only.
The command argument is a pointer to a null-terminated string containing a shell command line. This command is passed to /bin/sh using the
-c flag; interpretation, if any, is performed by the shell. The mode argument is a pointer to a null-terminated string which must be
either `r' for reading or `w' for writing.
The return value from popen() is a normal standard I/O stream in all respects save that it must be closed with pclose() rather than
fclose(). Writing to such a stream writes to the standard input of the command; the command's standard output is the same as that of the
process that called popen(), unless this is altered by the command itself. Conversely, reading from a ``popened'' stream reads the com-
mand's standard output, and the command's standard input is the same as that of the process that called popen.
Note that output popen streams are fully buffered by default.
The pclose function waits for the associated process to terminate and returns the exit status of the command as returned by wait4.
RETURN VALUE
The popen function returns NULL if the fork(2) or pipe(2) calls fail, or if it cannot allocate memory.
The pclose function returns -1 if wait4 returns an error, or some other error is detected.
ERRORS
The popen function does not set errno if memory allocation fails. If the underlying fork() or pipe() fails, errno is set appropriately.
If the mode argument is invalid, and this condition is detected, errno is set to EINVAL.
If pclose() cannot obtain the child status, errno is set to ECHILD.
CONFORMING TO
POSIX.2
BUGS
Since the standard input of a command opened for reading shares its seek offset with the process that called popen(), if the original
process has done a buffered read, the command's input position may not be as expected. Similarly, the output from a command opened for
writing may become intermingled with that of the original process. The latter can be avoided by calling fflush(3) before popen.
Failure to execute the shell is indistinguishable from the shell's failure to execute command, or an immediate exit of the command. The
only hint is an exit status of 127.
HISTORY
A popen() and a pclose() function appeared in Version 7 AT&T UNIX.
SEE ALSO
fork(2), sh(1), pipe(2), wait4(2), fflush(3), fclose(3), fopen(3), stdio(3), system(3)
BSD MANPAGE
1998-05-07 POPEN(3)