Sponsored Content
Top Forums UNIX for Advanced & Expert Users Linux fopen() mistery. Help required. Post 302294161 by kalbi on Wednesday 4th of March 2009 04:40:44 PM
Old 03-04-2009
Solved!
 

10 More Discussions You Might Find Interesting

1. UNIX Desktop Questions & Answers

Linux - Help Required

Hi guys! i have spent a whole day browsing and i couldn''t find a provider distributing free linux. I am a beginner and am looking for one that can run on Windows 98SE. Would deeply appreciate if you guys can help me. I went into "mirrors" site and was given lots of directory to d/l but i... (7 Replies)
Discussion started by: huimin0116
7 Replies

2. Programming

help required for linux MPI

hi I am starting with MPI programming, can anyone suggest me some books for MPI or some good online tutorials which will cover both theory and programming. thanks (0 Replies)
Discussion started by: bhakti
0 Replies

3. Solaris

su mistery

Hi All, Today I was logged in with my username (non root) on one of our Solaris 9 boxes and and typed "su - appserver". The strange thing is that I was not prompted for appserver's password and it allowed me to become "appserver" even if I am not root. Can anyone suggest where to look for... (5 Replies)
Discussion started by: midraga
5 Replies

4. Programming

fopen and open

what is the difference between fopen and open fread and read fwrite and write open and create why this much of functions for the i/o when everything does the same...? What is their major difference? In which case, which is the best to use. :confused:'ed Collins (2 Replies)
Discussion started by: collins
2 Replies

5. Programming

fopen() - don't know what I'm doing wrong

This code works fine when I use a command line argument for fopen()'s parameter, but when I change it to a filename, the program freezes upon compilation. input.txt is definitely there, so I can't figure it out. Thanks. #include <stdlib.h> #include <stdio.h> #include <ctype.h> int... (3 Replies)
Discussion started by: lazypeterson
3 Replies

6. Programming

overhead of fopen/freopen

I always assumed the fopen/freopen is very costly, so when I needed to work with many files within on process I spent extra time to implement a list of FILE * pointers to avoid extra open/reopen but it did not produced any better results. Here is a task at hand - there is a huge stream of data... (4 Replies)
Discussion started by: migurus
4 Replies

7. Linux

Required Icon Tray in Linux

Hello I am using linux machine. I need Icon tray in this. "Icon Tray" contains all the icons which we open in the workspace. As such, these icons appear at the bottom (similar to windows i.e.when we open internetexplorer, Word, XLs, these icons appear in the bottom) I have to open so many... (3 Replies)
Discussion started by: nehashine
3 Replies

8. Red Hat

required resize /boot partition in linux

Hi, In my linux box I have installed /boot partition with 100MB. I have done compile for a newer kernel. The both kernels are required to me. Finally /boot partition has using 100%. I need to resize the /boot. Any body give the solution how to do resize the /boot partition without dusturbing the... (2 Replies)
Discussion started by: parsrigum
2 Replies

9. What is on Your Mind?

Linux systemd - Is it really required?

I was testing Fedora 16 mostly to check the new features. One thing that caught my eye as a systems admin is the systemd which is incorporated in Fedora for quite a while now. From the first look of it, this appears more close to Solaris's SMF. With parallelization capabilities, advanced... (0 Replies)
Discussion started by: admin_xor
0 Replies

10. Programming

help plz - fopen()

Hello, I have a problem here, I want to write a function called"myfopen()" instead of "fopen()" for writing this function I must not use the <stdio.h> library, Can you help me? thanks a lot (2 Replies)
Discussion started by: hamed.samie
2 Replies
FOPEN(3)						     Linux Programmer's Manual							  FOPEN(3)

NAME
fopen, fdopen, freopen - stream open functions SYNOPSIS
#include <stdio.h> FILE *fopen(const char *path, const char *mode); FILE *fdopen(int fildes, const char *mode); FILE *freopen(const char *path, const char *mode, FILE *stream); DESCRIPTION
The fopen function opens the file whose name is the string pointed to by path and associates a stream with it. The argument mode points to a string beginning with one of the following sequences (Additional characters may follow these sequences.): r Open text file for reading. The stream is positioned at the beginning of the file. r+ Open for reading and writing. The stream is positioned at the beginning of the file. w Truncate file to zero length or create text file for writing. The stream is positioned at the beginning of the file. w+ Open for reading and writing. The file is created if it does not exist, otherwise it is truncated. The stream is positioned at the beginning of the file. a Open for appending (writing at end of file). The file is created if it does not exist. The stream is positioned at the end of the file. a+ Open for reading and appending (writing at end of file). The file is created if it does not exist. The stream is positioned at the end of the file. The mode string can also include the letter ``b'' either as a last character or as a character between the characters in any of the two- character strings described above. This is strictly for compatibility with ANSI X3.159-1989 (``ANSI C'') and has no effect; the ``b'' is ignored on all POSIX conforming systems, including Linux. (Other systems may treat text files and binary files differently, and adding the ``b'' may be a good idea if you do I/O to a binary file and expect that your program may be ported to non-Unix environments.) Any created files will have mode S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH (0666), as modified by the process' umask value (see umask(2)). Reads and writes may be intermixed on read/write streams in any order. Note that ANSI C requires that a file positioning function inter- vene between output and input, unless an input operation encounters end-of-file. (If this condition is not met, then a read is allowed to return the result of writes other than the most recent.) Therefore it is good practice (and indeed sometimes necessary under Linux) to put an fseek or fgetpos operation between write and read operations on such a stream. This operation may be an apparent no-op (as in fseek(..., 0L, SEEK_CUR) called for its synchronizing side effect. Opening a file in append mode (a as the first character of mode) causes all subsequent write operations to this stream to occur at end-of- file, as if preceded by an fseek(stream,0,SEEK_END); call. The fdopen function associates a stream with the existing file descriptor, fildes. The mode of the stream (one of the values "r", "r+", "w", "w+", "a", "a+") must be compatible with the mode of the file descriptor. The file position indicator of the new stream is set to that belonging to fildes, and the error and end-of-file indicators are cleared. Modes "w" or "w+" do not cause truncation of the file. The file descriptor is not dup'ed, and will be closed when the stream created by fdopen is closed. The result of applying fdopen to a shared memory object is undefined. The freopen function opens the file whose name is the string pointed to by path and associates the stream pointed to by stream with it. The original stream (if it exists) is closed. The mode argument is used just as in the fopen function. The primary use of the freopen function is to change the file associated with a standard text stream (stderr, stdin, or stdout). RETURN VALUE
Upon successful completion fopen, fdopen and freopen return a FILE pointer. Otherwise, NULL is returned and the global variable errno is set to indicate the error. ERRORS
EINVAL The mode provided to fopen, fdopen, or freopen was invalid. The fopen, fdopen and freopen functions may also fail and set errno for any of the errors specified for the routine malloc(3). The fopen function may also fail and set errno for any of the errors specified for the routine open(2). The fdopen function may also fail and set errno for any of the errors specified for the routine fcntl(2). The freopen function may also fail and set errno for any of the errors specified for the routines open(2), fclose(3) and fflush(3). CONFORMING TO
The fopen and freopen functions conform to ANSI X3.159-1989 (``ANSI C''). The fdopen function conforms to IEEE Std1003.1-1988 (``POSIX.1''). SEE ALSO
open(2), fclose(3), fileno(3) BSD MANPAGE
2002-01-03 FOPEN(3)
All times are GMT -4. The time now is 10:54 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy