Sponsored Content
Full Discussion: help with fseek
Top Forums Programming help with fseek Post 302344327 by ramkrix on Saturday 15th of August 2009 10:59:58 PM
Old 08-15-2009
Power help with fseek

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 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.

Thx in advance.
 

3 More Discussions You Might Find Interesting

1. Programming

error when using fseek() function

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)
Discussion started by: ivancheung
3 Replies

2. Programming

q on fseek() & ftell() + tga files

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)
Discussion started by: JamesGoh
2 Replies

3. Programming

help with reading a binary file and fseek

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)
Discussion started by: bjhum33
0 Replies
All times are GMT -4. The time now is 08:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy