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 screen.
say if *temp="979899", in ftemp also it will be 979899. From ftemp I need to read the file from the reverse direction. For that I used fseek as below
fseek(ftemp,0,SEEK_END) - this will place the pointer at the end. Now how to read it till the beginning, which function to use.. The contents from ftemp should be read in reverse directiona nd need to be printed in stdout.
Please help me, this is a kind of urgent requirement.
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)
In determining the true file size of a .tga file is the
fseek(fptr,0,SEEK_END);
file_size = ftell(fptr);
combination reliable ? The reason Im asking is because the value of file_size is in agreement with doing a
wc -c mytga.tga
however when I get the value of the extension... (2 Replies)
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)