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


 
Thread Tools Search this Thread
Top Forums Programming q on fseek() & ftell() + tga files
# 1  
Old 07-30-2008
q on fseek() & ftell() + tga files

In determining the true file size of a .tga file is the

Code:
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

Code:
wc -c mytga.tga

however when I get the value of the extension area offset, it turns out to be much larger than the actual file size.

Thoughts and comments are much appreciated

James
# 2  
Old 07-30-2008
I don't know what tga is, but see this old post of mine: https://www.unix.com/45748-post6.html
# 3  
Old 07-31-2008
sparse files are also called files with 'holes' in them. It is an attempt to save physical disk usage. It causes what you seem to see in your file.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Compressing & removing files in a directory & subdirectory

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

2. UNIX for Advanced & Expert Users

Find all files other than first two files dates & last file date for month

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)
Discussion started by: Makarand Dodmis
16 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

4. UNIX for Dummies Questions & Answers

How to compare 2 files & get specific value & replace it in other file.

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)
Discussion started by: reva
10 Replies

5. Shell Programming and Scripting

How to compare 2 files & get only few columns based on a condition related to both files?

Hiiiii friends I have 2 files which contains huge data & few lines of it are as shown below File1: b.dat(which has 21 columns) SSR 1976 8 12 13 10 44.00 39.0700 70.7800 7.0 0 0.00 0 2.78 0.00 0.00 0 0.00 2.78 0 NULL ISC 1976 8 12 22 32 37.39 36.2942 70.7338... (6 Replies)
Discussion started by: reva
6 Replies

6. Shell Programming and Scripting

Find & Replace string in multiple files & folders using perl

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)
Discussion started by: Zaheer.mic
0 Replies

7. Programming

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... (2 Replies)
Discussion started by: ramkrix
2 Replies

8. Programming

.tga file reader + programming language

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

9. Programming

Need help with ftell() function ..

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

10. 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
Login or Register to Ask a Question