Message-ID: <39A5527A.4FD240A5@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: Re: __DATA__ in c References: <wzjn5.7894$ZI2 DOT 334216 AT news1 DOT rdc1 DOT il DOT home DOT com> <834s4emb0i DOT fsf AT mercury DOT bitbucket> Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Lines: 52 Date: Thu, 24 Aug 2000 16:46:38 GMT NNTP-Posting-Host: 24.15.107.158 X-Complaints-To: abuse AT home DOT net X-Trace: news1.rdc1.il.home.com 967135598 24.15.107.158 (Thu, 24 Aug 2000 09:46:38 PDT) NNTP-Posting-Date: Thu, 24 Aug 2000 09:46:38 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.