Sponsored Content
Top Forums UNIX for Dummies Questions & Answers redirect output to a file name Post 302205072 by csecnarf on Friday 13th of June 2008 11:45:40 AM
Old 06-13-2008
Ok... it works!

and now... if I want to open this file in other function by

open (char *filename, int flags, int mode)

how can I do to recognize the $name variable inside the function?

Thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

redirect output to file?

Hi: I am currently working on a program which requires direct its ouput to a file here is an example ./proram arg_1 arg_2 when program ends all output will be arg_2 file Is that possible I am not a bad programmer, However I am stuck there. Can anyone give a hint? Thanks SW (1 Reply)
Discussion started by: slackware
1 Replies

2. UNIX for Dummies Questions & Answers

Redirect output to a file

Ahhhrrrggg I'm having a brain fart... I want to take the output of a command and redirect it to a file... This works.... $ man cp | cat >> copy_help but this doesn't keytool -help |cat >> keytool_help It just produces... these lines... more keytool_help ] ... ... (11 Replies)
Discussion started by: jimmyc
11 Replies

3. Shell Programming and Scripting

How redirect standard output to a file

Hi guys, i have a script named purgeErrors.ksh, when i execute this script i need to redirect the output to a log file in the same directory, how can i do that ?? -- Aditya (5 Replies)
Discussion started by: chaditya
5 Replies

4. Shell Programming and Scripting

How to redirect output of ls to a file?

Hi All, I want to redirect only the file names to a new file from the ls -ltr directroy. how Can i do it. my ls -ltr output will be as below. -rwxr-xr-x 1 118 103 28295 Jul 26 2006 event.podl -rwxr-xr-x 1 118 103 28295 Jul 26 2006 xyz.podl I want my new file... (6 Replies)
Discussion started by: girish.raos
6 Replies

5. Shell Programming and Scripting

Redirect the output in a file and on screen

I am trying to get following result from the scipt I have. First time it generates the o/p in correct format. However if I run it again it appends to the existing file. I would like to see o/p on screen as well as save it in file. Everytime it should create new file. ## I/P file 0174 0175... (3 Replies)
Discussion started by: dynamax
3 Replies

6. UNIX for Advanced & Expert Users

Redirect Topas output to a file

Hi, I want to know how to redirect the output of topas -P to a file in a readable format. I tried doing it by using topas -P > topas.txt but the output is not properly aligned and when I opened it using vi it ahd some characters. Please help me out in this. Thanks (1 Reply)
Discussion started by: Preetha
1 Replies

7. Shell Programming and Scripting

script to mail monitoring output if required or redirect output to log file

Below script perfectly works, giving below mail output. BUT, I want to make the script mail only if there are any D-Defined/T-Transition/B-Broken State WPARs and also to copy the output generated during monitoring to a temporary log file, which gets cleaned up every week. Need suggestions. ... (4 Replies)
Discussion started by: aix_admin_007
4 Replies

8. UNIX for Dummies Questions & Answers

Redirect output of echo to a file

Hi , I am trying to redirect output of echo to a file.So i wrote a function named printline.Here is my sample script myscript.sh function printline() { echo "$1" >> myfile.log } usage() { printLine "********************USAGE*************************" printLine "Script takes... (12 Replies)
Discussion started by: ASC
12 Replies

9. Shell Programming and Scripting

Redirect script output to a file and mail the output

Hi Guys, I want to redirect the output of 3 scripts to a file and then mail the output of those three scripts. I used below but it is not working: OFILE=/home/home1/report1 echo "report1 details" > $OFILE =/home/home1/1.sh > $OFILE echo... (7 Replies)
Discussion started by: Vivekit82
7 Replies

10. Shell Programming and Scripting

Unable to redirect output to a file

I m not able to redirect the java version to a file however, it shows as output when I run my script. bash-3.2$ more 1test.tmp java_version=`which java` echo "MY JAVA:"$java_version version=`"$java_version" -version` echo $version >>/tmp/moht/java_version.log $java_version -version 2... (4 Replies)
Discussion started by: mohtashims
4 Replies
explain_open(3) 					     Library Functions Manual						   explain_open(3)

NAME
explain_open - explain open(2) errors SYNOPSIS
#include <libexplain/open.h> const char *explain_open(const char *pathname, int flags, int mode); const char *explain_errno_open(int errnum, const char *pathname, int flags, int mode); void explain_message_open(char *message, int message_size, const char *pathname, int flags, int mode); void explain_message_errno_open(char *message, int message_size, int errnum, const char *pathname, int flags, int mode); DESCRIPTION
These functions may be used to obtains explanations for open(2) errors. explain_open(const char *pathname, int flags, int mode); const char *explain_open(const char *pathname, int flags, int mode); The explain_open function is used to obtain an explanation of an error returned by the open(2) system call. The least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. The errno global variable will be used to obtain the error value to be decoded. This function is intended to be used in a fashion similar to the following example: int fd = open(pathname, flags, mode); if (fd < 0) { fprintf(stderr, '%s0, explain_open(pathname, flags, mode)); exit(EXIT_FAILURE); } pathname The original pathname, exactly as passed to the open(2) system call. flags The original flags, exactly as passed to the open(2) system call. mode The original mode, exactly as passed to the open(2) system call (or zero if the original call didn't need a mode argument). Returns: The message explaining the error. This message buffer is shared by all libexplain functions which do not supply a buffer in their argument list. This will be overwritten by the next call to any libexplain function which shares this buffer, including other threads. Note: This function is not thread safe, because it shares a return buffer across all threads, and many other functions in this library. explain_errno_open const char *explain_errno_open(int errnum, const char *pathname, int flags, int mode); The explain_errno_open function is used to obtain an explanation of an error returned by the open(2) system call. The least the message will contain is the value of strerror(errnum), but usually it will do much better, and indicate the underlying cause in more detail. This function is intended to be used in a fashion similar to the following example: int fd = open(pathname, flags, mode); if (fd < 0) { int err = errno; fprintf(stderr, '%s0, explain_errno_open(err, pathname, flags, mode)); exit(EXIT_FAILURE); } errnum The error value to be decoded, usually obtained from the errno global variable just before this function is called. This is neces- sary if you need to call any code between the system call to be explained and this function, because many libc functions will alter the value of errno. pathname The original pathname, exactly as passed to the open(2) system call. flags The original flags, exactly as passed to the open(2) system call. mode The original mode, exactly as passed to the open(2) system call (or zero if the original call didn't need a mode argument). Returns: The message explaining the error. This message buffer is shared by all libexplain functions which do not supply a buffer in their argument list. This will be overwritten by the next call to any libexplain function which shares this buffer, including other threads. Note: This function is not thread safe, because it shares a return buffer across all threads, and many other functions in this library. explain_message_open void explain_message_open(char *message, int message_size, const char *pathname, int flags, int mode); The explain_message_open function is used to obtain an explanation of an error returned by the open(2) system call. The least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. The errno global variable will be used to obtain the error value to be decoded. This function is intended to be used in a fashion similar to the following example: int fd = open(pathname, flags, mode); if (fd < 0) { char message[3000]; explain_message_open(message, sizeof(message), pathname, flags, mode); fprintf(stderr, '%s0, message); exit(EXIT_FAILURE); } message The location in which to store the returned message. Because a message return buffer has been supplied, this function is thread safe. message_size The size in bytes of the location in which to store the returned message. pathname The original pathname, exactly as passed to the open(2) system call. flags The original flags, exactly as passed to the open(2) system call. mode The original mode, exactly as passed to the open(2) system call (or zero if the original call didn't need a mode argument). explain_message_errno_open void explain_message_errno_open(char *message, int message_size, int errnum, const char *pathname, int flags, int mode); The explain_message_errno_open function is used to obtain an explanation of an error returned by the open(2) system call. The least the message will contain is the value of strerror(errnum), but usually it will do much better, and indicate the underlying cause in more detail. This function is intended to be used in a fashion similar to the following exameple: int fd = open(pathname, flags, mode); if (fd < 0) { int err = errno; char message[3000]; explain_message_errno_open(message, sizeof(message), err, pathname, flags, mode); fprintf(stderr, '%s0, message); exit(EXIT_FAILURE); } message The location in which to store the returned message. Because a message return buffer has been supplied, this function is thread safe. message_size The size in bytes of the location in which to store the returned message. errnum The error value to be decoded, usually obtained from the errno global variable just before this function is called. This is neces- sary if you need to call any code between the system call to be explained and this function, because many libc functions will alter the value of errno. pathname The original pathname, exactly as passed to the open(2) system call. flags The original flags, exactly as passed to the open(2) system call. mode The original mode, exactly as passed to the open(2) system call (or zero if the original call didn't need a mode argument). COPYRIGHT
libexplain version 0.52 Copyright (C) 2008 Peter Miller AUTHOR
Written by Peter Miller <pmiller@opensource.org.au> explain_open(3)
All times are GMT -4. The time now is 01:06 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy