<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:SimSun;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:DengXian;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:DengXian;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:SimSun;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:"Source Code Pro";}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
text-align:justify;
text-justify:inter-ideograph;
font-size:10.5pt;
font-family:DengXian;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
pre
{mso-style-priority:99;
mso-style-link:"HTML \9884\8BBE\683C\5F0F \5B57\7B26";
margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:SimSun;}
span.HTML
{mso-style-name:"HTML \9884\8BBE\683C\5F0F \5B57\7B26";
mso-style-priority:99;
mso-style-link:"HTML \9884\8BBE\683C\5F0F";
font-family:SimSun;}
.MsoChpDefault
{mso-style-type:export-only;}
/* Page Definitions */
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
{page:WordSection1;}
--></style>
</head>
<body lang="ZH-CN" link="blue" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US">Hey guys. I have dump some jpg file, but I can’t open it with eog.</span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<div>
<pre style="background:white"><b><span lang="EN-US" style="font-size:15.0pt;font-family:"Source Code Pro",serif;color:navy">static int </span></b><span lang="EN-US" style="font-size:15.0pt;font-family:"Source Code Pro",serif;color:black">jpeg_id = </span><span lang="EN-US" style="font-size:15.0pt;font-family:"Source Code Pro",serif;color:blue">0</span><span lang="EN-US" style="font-size:15.0pt;font-family:"Source Code Pro",serif;color:black">;<br></span><b><span lang="EN-US" style="font-size:15.0pt;font-family:"Source Code Pro",serif;color:navy">static void </span></b><span lang="EN-US" style="font-size:15.0pt;font-family:"Source Code Pro",serif;color:black">dump_jpeg(uint8_t* data, </span><b><span lang="EN-US" style="font-size:15.0pt;font-family:"Source Code Pro",serif;color:navy">int </span></b><span lang="EN-US" style="font-size:15.0pt;font-family:"Source Code Pro",serif;color:black">data_size)<br>{<br> </span><b><span lang="EN-US" style="font-size:15.0pt;font-family:"Source Code Pro",serif;color:navy">char </span></b><span lang="EN-US" style="font-size:15.0pt;font-family:"Source Code Pro",serif;color:black">file_str[</span><span lang="EN-US" style="font-size:15.0pt;font-family:"Source Code Pro",serif;color:blue">200</span><span lang="EN-US" style="font-size:15.0pt;font-family:"Source Code Pro",serif;color:black">];<br> uint32_t id = ++jpeg_id;<br><br></span><span lang="EN-US" style="font-size:15.0pt;font-family:"Source Code Pro",serif;color:olive">#ifdef </span><span lang="EN-US" style="font-size:15.0pt;font-family:"Source Code Pro",serif;color:black">WIN32<br> sprintf(file_str, </span><b><span lang="EN-US" style="font-size:15.0pt;font-family:"Source Code Pro",serif;color:green">"c:</span></b><b><span lang="EN-US" style="font-size:15.0pt;font-family:"Source Code Pro",serif;color:navy">\\</span></b><b><span lang="EN-US" style="font-size:15.0pt;font-family:"Source Code Pro",serif;color:green">tmp</span></b><b><span lang="EN-US" style="font-size:15.0pt;font-family:"Source Code Pro",serif;color:navy">\\</span></b><b><span lang="EN-US" style="font-size:15.0pt;font-family:"Source Code Pro",serif;color:green">spice_dump</span></b><b><span lang="EN-US" style="font-size:15.0pt;font-family:"Source Code Pro",serif;color:navy">\\</span></b><b><span lang="EN-US" style="font-size:15.0pt;font-family:"Source Code Pro",serif;color:green">%u.jpg"</span></b><span lang="EN-US" style="font-size:15.0pt;font-family:"Source Code Pro",serif;color:black">, id);<br></span><span lang="EN-US" style="font-size:15.0pt;font-family:"Source Code Pro",serif;color:olive">#else<br> </span><span lang="EN-US" style="font-size:15.0pt;font-family:"Source Code Pro",serif;color:black">sprintf(file_str, </span><b><span lang="EN-US" style="font-size:15.0pt;font-family:"Source Code Pro",serif;color:green">"/tmp/spice_dump/%u.jpg"</span></b><span lang="EN-US" style="font-size:15.0pt;font-family:"Source Code Pro",serif;color:black">, id);<br></span><span lang="EN-US" style="font-size:15.0pt;font-family:"Source Code Pro",serif;color:olive">#endif<br><br> </span><span lang="EN-US" style="font-size:15.0pt;font-family:"Source Code Pro",serif;color:black">FILE *f = fopen(file_str, </span><b><span lang="EN-US" style="font-size:15.0pt;font-family:"Source Code Pro",serif;color:green">"wb"</span></b><span lang="EN-US" style="font-size:15.0pt;font-family:"Source Code Pro",serif;color:black">);<br> </span><b><span lang="EN-US" style="font-size:15.0pt;font-family:"Source Code Pro",serif;color:navy">if </span></b><span lang="EN-US" style="font-size:15.0pt;font-family:"Source Code Pro",serif;color:black">(!f) {<br> </span><b><span lang="EN-US" style="font-size:15.0pt;font-family:"Source Code Pro",serif;color:navy">return</span></b><span lang="EN-US" style="font-size:15.0pt;font-family:"Source Code Pro",serif;color:black">;<br> }<br><br> fwrite(data, </span><span lang="EN-US" style="font-size:15.0pt;font-family:"Source Code Pro",serif;color:blue">1</span><span lang="EN-US" style="font-size:15.0pt;font-family:"Source Code Pro",serif;color:black">, data_size, f);<br> fclose(f);<br>}<o:p></o:p></span></pre>
</div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:12.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal">发送自<span lang="EN-US"> Windows 10 </span>版<span lang="EN-US"><a href="https://go.microsoft.com/fwlink/?LinkId=550986"><span lang="EN-US"><span lang="EN-US">邮件</span></span></a></span>应用</p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:12.0pt;font-family:SimSun"><o:p> </o:p></span></p>
</div>
</body>
</html>