Mail Archives: djgpp/2000/08/27/20:02:52
Message-ID: | <39A9AA50.FA3AAE59@home.com>
|
From: | yhvhboy1 <yhvhboy1 AT home DOT com>
|
X-Mailer: | Mozilla 4.7 [en] (Win98; U)
|
X-Accept-Language: | en,el
|
MIME-Version: | 1.0
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | __DATA__ in c?
|
Lines: | 58
|
Date: | Sun, 27 Aug 2000 23:49:59 GMT
|
NNTP-Posting-Host: | 24.15.107.158
|
X-Complaints-To: | abuse AT home DOT net
|
X-Trace: | news1.rdc1.il.home.com 967420199 24.15.107.158 (Sun, 27 Aug 2000 16:49:59 PDT)
|
NNTP-Posting-Date: | Sun, 27 Aug 2000 16:49:59 PDT
|
Organization: | @Home Network
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
Nate Eldredge wrote:
> yhvhboy1 AT home DOT com writes:
>
> > assuming there's a few people out there that
> > know both perl and c -- i ask you this:
> > how do we store and retrieve __DATA__ in c?
>
> What is __DATA__? If it's a perl term, it's one beyond my experience.
in perl:
#!/usr/bin/perl
open(OUTFILE, ">c:/windows/my_outfile");
binmode(OUTFILE);
binmode(DATA);
while (read(DATA, $_, 1)) {
print OUTFILE $_;
}
# everything after __DATA__ is just contents of a file i'd like to save
# into c:\windows\my_outfile - can be binary or ascii
# we use binmode() to force binary (if that's what it is)
# the DATA filehandle is opened to read everything after __DATA__
# by default when our perlscript is compiled.
__DATA__
BMö‘ 6 ( ½ ½ À? Î Ä €€€ € €€ €
€€ € € € @€€ @@ ÿ€ €@ ÿ @ @€ ÿÿÿ ÀÀÀ ÿ ÿÿ ÿ ÿÿ ÿ ÿ ÿ €ÿÿ
€ÿ ÿÿ€ ÿ€€ € ÿ @€ÿ W F dP ™ p„1 ‚„ßS G Ü Í
/¬„7‚„ßS G WG ªö[ ªÃªö[ ,OÖ÷¿7[ ¼ô[
? D÷¿ 4~^ G ðô[ ]· G ªö[ ªö[ „õ[ ù·G
ªö[ àõ[ ø€ºjö[ ªÃ?º ¨
»4~^ ¬õ[ RI¸ÿÿÿÿ¸õ[ Í·F jö[ F *ö[ $?º ¨
»4~^ ìõ[ RI¸ÿÿÿÿøõ[ Í·G ªö[ G jö[ Xõ[ ö[
¸K¸ÿÿÿÿøõ[
&·4~^ < á €º ˜õ[ Tö[ ¸K¸ÿÿÿÿ8ö[ &·4~^
G
__END__
now, what i am trying to do is save contents of a binary file
in c, using the djgpp gcc compiler and compile the file
right in with my c program so i can read from it
and use its contents...
kind of like zip2exe, except with the ability
to write the file where i want and do other things
besides just unzip a zipfile--
in other words write more code around it-
not just do one thing (save a file).
and i'd like to do it without having to
store it into an array (would be a problem with say, a .iso
cd image - or other large files, etc.)
and i don't have a clue how to do it.
comp.lang.c told me to come here and ask
since it's beyond the core c language.
__
sorry to repost this but there was no response.
i waited a long time to reply -- oops.
- Raw text -