www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/02/11/04:46:28

From: G DOT DegliEsposti AT ads DOT it
To: djgpp AT delorie DOT com
Message-ID: <C12565A8.0031EA3F.00@vega.ads.it>
Date: Wed, 11 Feb 1998 10:15:40 +0100
Subject: Re: HELP - How to link Binary Files in a Data File
Mime-Version: 1.0




>Could someone please tell me how can I link all my binary data files in a
>single ONE using DJGPP ?!?! I would like a more simple and atractive
>solution instead of the old "copy /b ...+...+.." and modify the offsets in
>the data reader !!! Instead, if someone can tell me how to link all those
in
>the .EXE file, would be fine too !

You can write some utility converting binary files to ordinary C files
containing only a large initialized array, something like this:

output to "datafile.c" the string "unsigned char program_data[] = {"
for every file
  for every byte read from the file
    output to "datafile.c" the byte as a string  ( sprintf(str, "%d,",
byte); )
output to "datafile.c" the string"0 };"

then you can compile your datafile.c into a .o and then your program can
access the data using program_data as any other array.

(of course you don't have to take this literal, but can give you a hint :-)

ciao
  Giacomo



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019