The errors EBADF & ESPIPE occur at this fseek call. Does anybody know how to solve this problem? Thanks in advance.
toFileStream=fdopen(localFileDes,"ra+");
if(fseek(toFileStream, 0, SEEK_END)!=0){
if(errno==EBADF)
printf("errno==EBADF\n");
if(errno==EINVAL)... (3 Replies)
Hello friends,
I need help with ftell function in my programme, I can't figure out why I am not getting the file position what I supposed to get
Here is my code
void read_line(void *fh, double *input_re, double *input_im){
double a, b;
char s;
int n;
... (3 Replies)
For a job I have to do, I have to design a .tga file reader, however I have had no prior experience in this area, so I was wondering what would be the best language to use to develop my .tga reader ?
many thanks (1 Reply)
Hi,
I working a c project in IBM AIX. I have a requirement like this.
I have some contents in *temp. I am writing the contents of *temp to a file pointer ftemp (*ftemp for an tmp file tmpfile.txt)
Now I want to read the contents of *ftemp in the reverse order an dneed to print it in the... (2 Replies)
find . -type f -name "*.sql" -print|xargs perl -i -pe 's/pattern/replaced/g'
this is simple logic to find and replace in multiple files & folders
Hope this helps.
Thanks
Zaheer (0 Replies)
Hiiii Friends
I have 2 files with huge data. I want to compare this 2 files & if they hav same set of vales in specific rows & columns i need to get that value from one file & replace it in other.
For example: I have few set data of both files here:
a.dat:
PDE-W 2009 12 16 5 29 11.11 ... (10 Replies)
this is my code and no matter what record number the user enters i cant get any of the records fields to read into the structure acct. What am i doing wrong?
#include <stdio.h>
typedef struct
{
char name;
int number;
float balance;
} acct_info_t;
int main (int... (0 Replies)
Hi All,
I need to find all files other than first two files dates & last file date for month and month/year wise list.
lets say there are following files in directory
Mar 19 2012 c.txt
Mar 19 2012 cc.txt
Mar 21 2012 d.txt
Mar 22 2012 f.txt
Mar 24 2012 h.txt
Mar 25 2012 w.txt
Feb 12... (16 Replies)
Hi,
I want a simple line of code that will compress files within a directory specified (parameter) and its subdirectories and also i want to remove files which are exactly 365 days old from the sysdate after this compression.
Please help.
Thanks,
JD (8 Replies)
Discussion started by: Jesshelle David
8 Replies
LEARN ABOUT REDHAT
rewind
FSEEK(3) Linux Programmer's Manual FSEEK(3)NAME
fgetpos, fseek, fsetpos, ftell, rewind - reposition a stream
SYNOPSIS
#include <stdio.h>
int fseek(FILE *stream, long offset, int whence);
long ftell(FILE *stream);
void rewind(FILE *stream);
int fgetpos(FILE *stream, fpos_t *pos);
int fsetpos(FILE *stream, fpos_t *pos);
DESCRIPTION
The fseek function sets the file position indicator for the stream pointed to by stream. The new position, measured in bytes, is obtained
by adding offset bytes to the position specified by whence. If whence is set to SEEK_SET, SEEK_CUR, or SEEK_END, the offset is relative to
the start of the file, the current position indicator, or end-of-file, respectively. A successful call to the fseek function clears the
end-of-file indicator for the stream and undoes any effects of the ungetc(3) function on the same stream.
The ftell function obtains the current value of the file position indicator for the stream pointed to by stream.
The rewind function sets the file position indicator for the stream pointed to by stream to the beginning of the file. It is equivalent
to:
(void)fseek(stream, 0L, SEEK_SET)
except that the error indicator for the stream is also cleared (see clearerr(3)).
The fgetpos and fsetpos functions are alternate interfaces equivalent to ftell and fseek (with whence set to SEEK_SET), setting and storing
the current value of the file offset into or from the object referenced by pos. On some non-UNIX systems an fpos_t object may be a complex
object and these routines may be the only way to portably reposition a text stream.
RETURN VALUE
The rewind function returns no value. Upon successful completion, fgetpos, fseek, fsetpos return 0, and ftell returns the current offset.
Otherwise, -1 is returned and the global variable errno is set to indicate the error.
ERRORS
EBADF The stream specified is not a seekable stream.
EINVAL The whence argument to fseek was not SEEK_SET, SEEK_END, or SEEK_CUR.
The function fgetpos, fseek, fsetpos, and ftell may also fail and set errno for any of the errors specified for the routines fflush(3),
fstat(2), lseek(2), and malloc(3).
CONFORMING TO
The fgetpos, fsetpos, fseek, ftell, and rewind functions conform to ANSI X3.159-1989 (``ANSI C'').
SEE ALSO lseek(2), fseeko(3)BSD MANPAGE 1993-11-29 FSEEK(3)