[fpc-pascal] Including binary data making easy
Rainer Stratmann
RainerStratmann at t-online.de
Mon Mar 23 16:35:59 CET 2009
Am Montag, 23. März 2009 16:09 schrieb Michael Van Canneyt:
> On Mon, 23 Mar 2009, Rainer Stratmann wrote:
> > Am Montag, 23. März 2009 15:52 schrieb Michael Van Canneyt:
> > > On Mon, 23 Mar 2009, Rainer Stratmann wrote:
> > > > Would this be possible?
> > > >
> > > > // get access to the data of file.dat
> > > > // have 1 executable file with containing all the data
> > > >
> > > > {$ir file.dat mydata} // include resource or similar
> > > >
> > > > // fpc compiler makes this
> > > > const
> > > > mydata : array[ 0 .. 4 ] of byte =
> > > > ($45,$44,$63,$76,$55); // file data
> > > >
> > > > // the length can find out with sizeof( mydata );
> > >
> > > There are 2 fpc tools that do this for you.
> > >
> > > bin2obj and data2inc
> >
> > Yes, but that means a step more to get the solution.
> > It would be much easier in the way described above.
> > And easy to implement so that all users get advantage of this.
>
> You can use RCData resources, that works on all platforms.
> Then you need to use LoadResource()
Yes, this means also - as I understand it - that you have to make an
additional step to create the resource file.
For me it looks complicated. If a file's content is change then it can happen
that you forget to create the resource file and so on...
Rainer
> Michael.
More information about the fpc-pascal
mailing list