TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Jussi Hamalainen
from: Bill Birrell
date: 1998-09-16 18:37:00
subject: music

Jussi,

 > How come a friend of mine then made a program - in C -
 > for me
 > that reads a JPEG file appended to the .EXE and
 > displays it on
 > the screen? It works just as I explained: it seeks to
 > the end of
 > the .EXE and then starts reading in the JPEG data.

    Strictly speaking Robin is right, but if you are only interested in
MSDos, and have a compiler which supports language extensions, then
filesize(), fstat() or stat() will do it, but these are not part of the
ANSI standard.

    If you wish to stick to the ANSI standard, you must fopen( a stream)
then fseek() to the end of the file, and either start your reading from
there, or perform an fgetpos() or ftell() and use the information so
obtained. The interesting thing is what you don't mention - how your friend
extends the exe file length without messing up the exe header. :-)

    Hope this helps to explain what may have seemed inexplicable. :-)

best wishes,
Bill.

---
* Origin: Meerkats Anonymous (2:2504/200)
SEEN-BY: 396/1 622/419 632/0 371 633/260 267 270 371 634/397 635/506 728 810
SEEN-BY: 639/252 670/218
@PATH: 2504/200 213 255/3 1 251/25 396/1 633/260 635/506 728 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.