[prev in list] [next in list] [prev in thread] [next in thread] 

List:       boost-users
Subject:    [Boost-users] Tried to unzip a file , and followed the example in the boost.org as well, but it does
From:       asfskfdjkj kfasjfkasjf via Boost-users <boost-users () lists ! boost ! org>
Date:       2021-03-30 13:14:33
Message-ID: 2131735795.2028138.1617110073276 () mail ! yahoo ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi guys      I tried to unzip a file with code below which exactly like the example \
from boost.org, but it doesn't work   the example is in the link which is  Zlib \
Filters

> 
> 
> > 
Zlib Filters


 |

 |

 |


I tried the code like the below
try{        ifstream file("d:\\202012303333629003180526491.txt.zip", ios_base::in | \
ios_base::binary);        \
boost::iostreams::filtering_streambuf<boost::iostreams::input> in;        \
in.push(boost::iostreams::zlib_decompressor());        in.push(file);         \
boost::iostreams::copy(in, cout);         return 0;}catch (const std::exception& \
error)  {  std::cerr << error.what() << std::endl;
      return (EXIT_FAILURE);
   }
it's not working, it get exception when it excuted  boost::iostreams::copy(in, cout); \
I got the    zlib error: iostream stream error exception thoughwhat wrong I have done \
though? thank you


[Attachment #5 (text/html)]

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" \
xmlns:o="urn:schemas-microsoft-com:office:office"><head><!--[if gte mso \
9]><xml><o:OfficeDocumentSettings><o:AllowPNG/><o:PixelsPerInch>96</o:PixelsPerInch></o:OfficeDocumentSettings></xml><![endif]--></head><body><div \
class="yahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, \
sans-serif;font-size:16px;"><div dir="ltr" data-setdir="false">Hi guys</div><div \
dir="ltr" data-setdir="false">&nbsp; &nbsp; I tried to unzip a file with code below \
which exactly like the example from boost.org, but it doesn't work&nbsp;</div><div \
dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">the \
example is in the link which is&nbsp;<span class="TSRSpan" id="TSRSpan_22"><img \
class="TSRWebRatingIcon" \
src="chrome-extension://ohhcpmplhhiiaoiddkfboafbhiknefdf/images/tooltip/webicon_green.png" \
data-inlineimagemanipulating="true" style="width: 16px; height: 16px; border: \
0px;"></span><a href="https://www.boost.org/doc/libs/1_57_0/libs/iostreams/doc/classes/zlib.html" \
rel="nofollow" target="_blank" class="enhancr_card_7957688213" \
style="background-color: rgb(184, 234, 184);">Zlib \
Filters</a></div><div><br></div><div id="ydp2c113d99enhancr_card_7957688213" \
class="ydp2c113d99yahoo-link-enhancr-card \
ydp2c113d99yahoo-link-enhancr-not-allow-cover ydp2c113d99ymail-preserve-class \
ydp2c113d99ymail-preserve-style" style="max-width:400px;font-family:YahooSans, \
&quot;Helvetica Neue&quot;, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif" \
data-url="https://www.boost.org/doc/libs/1_57_0/libs/iostreams/doc/classes/zlib.html" \
data-type="YENHANCER" data-size="MEDIUM" contenteditable="false"><span \
class="TSRSpan" id="TSRSpan_24"><img class="TSRWebRatingIcon" \
src="chrome-extension://ohhcpmplhhiiaoiddkfboafbhiknefdf/images/tooltip/webicon_green.png" \
data-inlineimagemanipulating="true" style="width: 16px; height: 16px; border: \
0px;"></span><a href="https://www.boost.org/doc/libs/1_57_0/libs/iostreams/doc/classes/zlib.html" \
style="text-decoration: none !important; color: rgb(0, 0, 0) !important; \
background-color: rgb(184, 234, 184);" class="ydp2c113d99yahoo-enhancr-cardlink" \
rel="nofollow" target="_blank"><table border="0" class="ydp2c113d99card-wrapper \
ydp2c113d99yahoo-ignore-table" cellpadding="0" cellspacing="0" \
style="max-width:400px"><tbody><tr><td width="400"><table border="0" \
class="ydp2c113d99card ydp2c113d99yahoo-ignore-table" cellpadding="0" cellspacing="0" \
width="100%" style="max-width:400px;border-width:1px;border-style:solid;border-color:rgb(224, \
228, 233);border-radius:2px"><tbody><tr><td><table border="0" \
class="ydp2c113d99card-info ydp2c113d99yahoo-ignore-table" cellpadding="0" \
cellspacing="0" style="background:#fff;position:relative;z-index:2;width:100%;max-width:400px;border-radius:0 \
0 2px 2px;border-top:1px solid rgb(224, 228, 233)"><tbody><tr><td \
style="background-color:#ffffff;padding:16px 0 16px \
12px;vertical-align:top;border-radius:0 0 0 2px"></td><td \
style="vertical-align:middle;padding:12px 24px 16px \
12px;width:99%;font-family:YahooSans, &quot;Helvetica Neue&quot;, &quot;Segoe \
UI&quot;, Helvetica, Arial, sans-serif;border-radius:0 0 2px 0"><h2 \
class="ydp2c113d99card-title" style="font-size: 14px; line-height: 19px; margin: 0px \
0px 6px; font-family: YahooSans, &quot;Helvetica Neue&quot;, &quot;Segoe UI&quot;, \
Helvetica, Arial, sans-serif; color: rgb(38, 40, 42); max-width: 314px;">Zlib \
Filters</h2><p class="ydp2c113d99card-description" style="font-size: 12px; \
line-height: 16px; margin: 0px; color: rgb(151, 155, \
167);"></p></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></a></div><div><br></div><div \
dir="ltr" data-setdir="false">I tried the code like the \
below</div><div><br></div><div dir="ltr" data-setdir="false">try</div><div dir="ltr" \
data-setdir="false">{</div><div dir="ltr" data-setdir="false"><div><div>&nbsp; &nbsp; \
&nbsp;ifstream file("d:\\202012303333629003180526491.txt.zip", ios_base::in | \
ios_base::binary);</div><div>&nbsp; &nbsp; \
&nbsp;boost::iostreams::filtering_streambuf&lt;boost::iostreams::input&gt; \
in;</div><div>&nbsp; &nbsp; \
&nbsp;in.push(boost::iostreams::zlib_decompressor());</div><div>&nbsp; &nbsp; \
&nbsp;in.push(file);</div><div>&nbsp; &nbsp; &nbsp; boost::iostreams::copy(in, \
cout);</div><div>&nbsp; &nbsp; &nbsp; return 0;</div></div><div>}</div><div><span \
class="ydpa1cc9020hljs-keyword" style="background-color: transparent; font-family: \
inherit; font-style: inherit; font-weight: inherit; white-space: inherit; margin: \
0px; padding: 0px; border: 0px; font-stretch: inherit; line-height: inherit; \
vertical-align: baseline;">catch</span><span style="background-color: transparent; \
font-family: inherit; font-style: inherit; font-weight: inherit; white-space: \
inherit;"> (</span><span class="ydpa1cc9020hljs-keyword" style="background-color: \
transparent; font-family: inherit; font-style: inherit; font-weight: inherit; \
white-space: inherit; margin: 0px; padding: 0px; border: 0px; font-stretch: inherit; \
line-height: inherit; vertical-align: baseline;">const</span><span \
style="background-color: transparent; font-family: inherit; font-style: inherit; \
font-weight: inherit; white-space: inherit;"> </span><span \
class="ydpa1cc9020hljs-built_in" style="background-color: transparent; font-family: \
inherit; font-style: inherit; font-weight: inherit; white-space: inherit; margin: \
0px; padding: 0px; border: 0px; font-stretch: inherit; line-height: inherit; \
vertical-align: baseline;">std</span><span style="background-color: transparent; \
font-family: inherit; font-style: inherit; font-weight: inherit; white-space: \
inherit;">::exception&amp; error)</span></div><div><pre class="ydpa1cc9020default \
ydpa1cc9020s-code-block ydpa1cc9020hljs ydpa1cc9020cpp" style="margin-top: 0px; \
padding: 12px; border: 0px; font-stretch: inherit; line-height: 1.30769; font-family: \
Consolas, Menlo, Monaco, &quot;Lucida Console&quot;, &quot;Liberation Mono&quot;, \
&quot;DejaVu Sans Mono&quot;, &quot;Bitstream Vera Sans Mono&quot;, &quot;Courier \
New&quot;, monospace, sans-serif; vertical-align: baseline; width: auto; \
border-radius: 5px; min-height: 600px;"><code style="margin: 0px; padding: 0px; \
border: 0px; font-style: inherit; font-weight: inherit; font-stretch: inherit; \
line-height: inherit; font-family: inherit; vertical-align: baseline; \
background-color: transparent; white-space: inherit;">  {  <span \
class="ydpa1cc9020hljs-built_in" style="margin: 0px; padding: 0px; border: 0px; \
font-style: inherit; font-weight: inherit; font-stretch: inherit; line-height: \
inherit; font-family: inherit; vertical-align: baseline;">std</span>::<span \
class="ydpa1cc9020hljs-built_in" style="margin: 0px; padding: 0px; border: 0px; \
font-style: inherit; font-weight: inherit; font-stretch: inherit; line-height: \
inherit; font-family: inherit; vertical-align: baseline;">cerr</span> &lt;&lt; \
error.what() &lt;&lt; <span class="ydpa1cc9020hljs-built_in" style="margin: 0px; \
padding: 0px; border: 0px; font-style: inherit; font-weight: inherit; font-stretch: \
inherit; line-height: inherit; font-family: inherit; vertical-align: \
baseline;">std</span>::<span class="ydpa1cc9020hljs-built_in" style="margin: 0px; \
padding: 0px; border: 0px; font-style: inherit; font-weight: inherit; font-stretch: \
inherit; line-height: inherit; font-family: inherit; vertical-align: \
baseline;">endl</span>;  <span class="ydpa1cc9020hljs-keyword" style="margin: 0px; \
padding: 0px; border: 0px; font-style: inherit; font-weight: inherit; font-stretch: \
inherit; line-height: inherit; font-family: inherit; vertical-align: \
baseline;">return</span> (EXIT_FAILURE);  }</code></pre></div></div><div dir="ltr" \
data-setdir="false"><br></div><div dir="ltr" data-setdir="false">it's not working, it \
get exception when it excuted&nbsp;<span><span style="color: rgb(0, 0, 0); \
font-family: &quot;Helvetica Neue&quot;, Helvetica, Arial, sans-serif; font-size: \
16px;">boost::iostreams::copy(in, cout);&nbsp;</span></span></div><div dir="ltr" \
data-setdir="false">I got the&nbsp;<span><span style="color: rgb(36, 39, 41); \
font-family: Arial, &quot;Helvetica Neue&quot;, Helvetica, sans-serif; font-size: \
15px;">&nbsp;zlib error: iostream stream error exception \
though</span></span></div><div dir="ltr" data-setdir="false"><span><span \
style="color: rgb(36, 39, 41); font-family: Arial, &quot;Helvetica Neue&quot;, \
Helvetica, sans-serif; font-size: 15px;">what wrong I have done though? thank \
you</span></span></div></div></body></html>



_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
https://lists.boost.org/mailman/listinfo.cgi/boost-users


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic