Sponsored Content
Full Discussion: Open file function
Top Forums Shell Programming and Scripting Open file function Post 302905329 by maverick72 on Wednesday 11th of June 2014 04:11:59 AM
Old 06-11-2014
Browser is firefox at work and seems to hate my code.

Had to fix with phone :-(
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

function to test if file is open

I need to write a function that will work in sh/ksh shell that will test to see if a file has already been opened for writting by another user has anyone written something like this? (3 Replies)
Discussion started by: johnsonbryce
3 Replies

2. UNIX and Linux Applications

Sybase help: Open client, bcp function

To begin: I use Linux The Problem: I need bcp functionality for scripts. Perl modules, such as Sybase:xfer, require ctlib which comes with Sybase Open Client. Talking with Sybase sales reps is an exercise in futility and hate. They know absolutely nothing about their own products and will... (0 Replies)
Discussion started by: Bubnoff
0 Replies

3. Programming

Some how the open(file,flag, acc) returns 0 and write to the screen, instead of the file ???

I am out of idea what to do to resolve the problem! I need to use the open(file, for.., access) function to write a file. Never have the situation like that: it is return 0 - zero. As a result all write(..) going to the screen! What the problem it could be? I do not even know... (2 Replies)
Discussion started by: alex_5161
2 Replies

4. Programming

Open function of sys/stat.h

If a process already has the entire file locked for read and write using newstruct.l_type = F_WRLCK; what would happen if another process would try to open it in read only mode using open(filename, O_RDONLY); ? I want to check if the file exists and I want it to work even if another process has... (4 Replies)
Discussion started by: cyler
4 Replies

5. Red Hat

cannot set user id: Resource temporarily unavailable (not open file/open process related)

First post, sorry to be a bother but this one has been dogging me. I have a process user (java application server) that trips a resource limit every couple weeks and need help finding what limit we're hitting. First, this is what's running: This is the error when jobs are run or the... (0 Replies)
Discussion started by: Katahdin
0 Replies

6. Solaris

Before I delete any file in Unix, How can I check no open file handle is pointing to that file?

I know how to check if any file has a unix process using a file by looking at 'lsof <fullpath/filename>' command. I think using lsof is very expensive. Also to make it accurate we need to inlcude fullpath of the file. Is there another command that can tell if a file has a truely active... (12 Replies)
Discussion started by: kchinnam
12 Replies

7. Shell Programming and Scripting

Newbie.. Find if a file exists and open, if not create the desired file..

Hey all, I'm brand new to script writing, I'm wanting to make a script that will ask for a file and then retrieve that file if it exists, and if it doesn't exist, create the file with the desired name, and I'm completely stuck.. so far.. #! bin/bash echo "Enter desired file" read "$file" if ... (5 Replies)
Discussion started by: Byrang
5 Replies

8. Shell Programming and Scripting

Help !! perl open function

Help Please perl Gurus, I am trying to add ungrouped passengers in a group and I creating a script however it fails on first step only I tried all the options it returns following error. syntax error at junki line 4, near "open " Execution of junki aborted due to compilation errors. ... (2 Replies)
Discussion started by: dynamax
2 Replies

9. Programming

Function open() sets errno

I am opening a text file using open() system call in O_RDONLY mode. open() returns me a valid handler but also sets errno to 13 i.e. EACCES(Permission denied). Question is when open() is returning a valid handler then why does it sets the errno? Should not errno be set only in case of error... (10 Replies)
Discussion started by: rupeshkp728
10 Replies

10. Shell Programming and Scripting

Help to Modify File Name in each function before calling another function.

I have a script which does gunzip, zip and untar. Input to the script is file name and file directory (where file is located) I am reading the input parameters as follows: FILENAME=$1 FILEDIR=$2 I have created 3 functions that are as follows: 1) gunzip file 2) unzip file... (2 Replies)
Discussion started by: pinnacle
2 Replies
fdopen(3C)						   Standard C Library Functions 						fdopen(3C)

NAME
fdopen - associate a stream with a file descriptor SYNOPSIS
#include <stdio.h> FILE *fdopen(int fildes, const char *mode); DESCRIPTION
The fdopen() function associates a stream with a file descriptor fildes. The mode argument is a character string having one of the following values: r or rb Open a file for reading. w or wb Open a file for writing. a or ab Open a file for writing at end of file. r+, rb+ or r+b Open a file for update (reading and writing). w+, wb+ or w+b Open a file for update (reading and writing). a+, ab+ or a+b Open a file for update (reading and writing) at end of file. The meaning of these flags is exactly as specified for the fopen(3C) function, except that modes beginning with w do not cause truncation of the file. A trailing F character can also be included in the mode argument as described in fopen(3C) to enable extended FILE facility. The mode of the stream must be allowed by the file access mode of the open file. The file position indicator associated with the new stream is set to the position indicated by the file offset associated with the file descriptor. The fdopen() function preserves the offset maximum previously set for the open file description corresponding to fildes. The error and end-of-file indicators for the stream are cleared. The fdopen() function may cause the st_atime field of the underlying file to be marked for update. If fildes refers to a shared memory object, the result of the fdopen() function is unspecified. RETURN VALUES
Upon successful completion, fdopen() returns a pointer to a stream. Otherwise, a null pointer is returned and errno is set to indicate the error. The fdopen() function may fail and not set errno if there are no free stdio streams. ERRORS
The fdopen() function may fail if: EBADF The fildes argument is not a valid file descriptor. EINVAL The mode argument is not a valid mode. EMFILE {FOPEN_MAX} streams are currently open in the calling process. {STREAM_MAX} streams are currently open in the calling process. ENOMEM There is insufficient space to allocate a buffer. USAGE
A process is allowed to have at least {FOPEN_MAX} stdio streams open at a time. For 32-bit applications, however, the underlying ABIs for- merly required that no file descriptor used to access the file underlying a stdio stream have a value greater than 255. To maintain binary compatibility with earlier Solaris releases, this limit still constrains 32-bit applications. File descriptors are obtained from calls like open(2), dup(2), creat(2) or pipe(2), which open files but do not return streams. Streams are necessary input for almost all of the standard I/O library functions. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |See below. | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ The F character in the mode argument is Evolving. In all other respects this function is Standard. SEE ALSO
creat(2), dup(2), open(2), pipe(2), fclose(3C), fopen(3C), attributes(5), standards(5) SunOS 5.11 18 Apr 2006 fdopen(3C)
All times are GMT -4. The time now is 06:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy