⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 一个文本格式转化程序.mht

📁 精华BBS贴子
💻 MHT
📖 第 1 页 / 共 5 页
字号:
                  border=3D0></A> </TD></TR></TBODY></TABLE></TD></TR>
        <TR>
          <TD bgColor=3Ddarkblue>
            <TABLE cellSpacing=3D1 cellPadding=3D4 width=3D"100%" =
border=3D0>
              <TBODY>
              <TR class=3Dheader>
                <TD width=3D152>=D7=F7=D5=DF:</TD>
                <TD>
                  <TABLE class=3Dsmalltxt=20
                  style=3D"TABLE-LAYOUT: fixed; WORD-WRAP: break-word"=20
                  cellSpacing=3D0 cellPadding=3D0 width=3D"100%" =
border=3D0>
                    <TBODY>
                    <TR style=3D"COLOR: #ffffff">
                      <TD class=3Dbold>=B1=EA=CC=E2: =
=D2=BB=B8=F6=CE=C4=B1=BE=B8=F1=CA=BD=D7=AA=BB=AF=B3=CC=D0=F2</TD>
                      <TD noWrap align=3Dright width=3D150><A=20
                        style=3D"FONT-WEIGHT: normal; COLOR: #ffffff"=20
                        =
href=3D"http://25.20.176.12/bbs/redirect.php?fid=3D144&amp;tid=3D33134&am=
p;goto=3Dnextoldset">=C9=CF=D2=BB=D6=F7=CC=E2</A>=20
                        | <A style=3D"FONT-WEIGHT: normal; COLOR: =
#ffffff"=20
                        =
href=3D"http://25.20.176.12/bbs/redirect.php?fid=3D144&amp;tid=3D33134&am=
p;goto=3Dnextnewset">=CF=C2=D2=BB=D6=F7=CC=E2</A></TD></TR></TBODY></TABL=
E></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE><A=20
      name=3Dpid317568>
      <TABLE cellSpacing=3D0 cellPadding=3D0 width=3D"100%" =
align=3Dcenter border=3D0>
        <TBODY>
        <TR>
          <TD bgColor=3Ddarkblue>
            <TABLE style=3D"TABLE-LAYOUT: fixed; WORD-WRAP: break-word"=20
            cellSpacing=3D1 cellPadding=3D4 width=3D"100%" border=3D0>
              <TBODY>
              <TR bgColor=3D#e8f2ff>
                <TD vAlign=3Dtop width=3D160>
                  <FIELDSET><LEGEND><A=20
                  =
href=3D"http://25.20.176.12/bbs/viewthread.php?tid=3D33134#endpid317568">=
<IMG=20
                  alt=3D=D7=AA=B5=BD=B5=DA1=CC=F9=C4=A9=CE=B2=20
                  =
src=3D"http://25.20.176.12/bbs/images/default/threadnext.gif"=20
                  border=3D0></A> <FONT title=3DPID=3D317568 =
color=3Dred>=C2=A5=D6=F7</FONT>=20
                  </LEGEND>
                  <TABLE style=3D"TABLE-LAYOUT: fixed" cellSpacing=3D0 =
cellPadding=3D0=20
                  width=3D"100%" border=3D0>
                    <TBODY>
                    <TR>
                      <TD>
                        <CENTER>
                        <H3>jyarmy</H3></CENTER><BR></TD></TR>
                    <TR bgColor=3D#e8f2cf>
                      <TD align=3Dmiddle><IMG=20
                        =
src=3D"http://25.20.176.12/bbs/customavatars/356.gif"=20
                        border=3D0></TD></TR>
                    <TR>
                      <TD align=3Dmiddle><IMG=20
                        =
src=3D"http://25.20.176.12/bbs/images/default/star.gif"><IMG=20
                        =
src=3D"http://25.20.176.12/bbs/images/default/star.gif"></TD></TR></TBODY=
></TABLE></FIELDSET>=20

                  <TABLE cellSpacing=3D0 cellPadding=3D3 width=3D"100%" =
border=3D0>
                    <TBODY>
                    <TR>
                      <TD class=3Drow><IMG height=3D11=20
                        =
src=3D"http://25.20.176.12/bbs/images/default/ball.gif"=20
                        width=3D10> =CD=B7=CF=CE: <FONT =
color=3Dred>=BD=F0=A1=B0=D6=A5=A1=B1=D3=F1=A1=B0=D2=B6=A1=B1</FONT></TD><=
/TR>
                    <TR>
                      <TD class=3Drow><IMG height=3D11=20
                        =
src=3D"http://25.20.176.12/bbs/images/default/ball.gif"=20
                        width=3D10> =D0=D4=B1=F0: <FONT =
color=3Dred>=C4=D0<IMG title=3D=D0=D4=B1=F0=A3=BA=C4=D0=20
                        =
src=3D"http://25.20.176.12/bbs/images/default/male.gif">=20
                        </FONT><!--(=B7=A2=CC=F9:<font =
color=3D"red">2893</font>=C6=AA)--></TD></TR>
                    <TR>
                      <TD class=3Drow title=3D"=BB=FD=B7=D6:408 =
=B7=D6<br>=B7=A2=CC=F9:2893 =C6=AA"><IMG=20
                        height=3D11=20
                        =
src=3D"http://25.20.176.12/bbs/images/default/ball.gif"=20
                        width=3D10> =BB=FD=B7=D6: <FONT =
color=3Dred>408</FONT>=B7=D6<!--(=B7=A2=CC=F9:<font =
color=3D"red">2893</font>=C6=AA)--></TD></TR>
                    <TR>
                      <TD class=3Drow =
title=3D"=BE=AB=BB=AA=D6=B8=CA=FD:16 =B7=D6<br>=B7=A2=CC=F9:2893 =
=C6=AA"><IMG=20
                        height=3D11=20
                        =
src=3D"http://25.20.176.12/bbs/images/default/ball.gif"=20
                        width=3D10> =B7=A2=CC=F9: <FONT =
color=3Dred>2893</FONT>=C6=AA</TD></TR>
                    <TR>
                      <TD class=3Drow=20
                      =
title=3D"=B2=C6=B8=BB:4466+2870<br>=CF=D6=BD=F0:4466<br>=B4=E6=BF=EE:2870=
<br>=D3=F1=C2=A5=D2=F8=BA=A3"><IMG=20
                        height=3D11=20
                        =
src=3D"http://25.20.176.12/bbs/images/default/ball.gif"=20
                        width=3D10> =B2=C6=B8=BB: <FONT =
color=3Dred>7336</FONT> =BD=F0=B1=D2</TD></TR>
                    <TR>
                      <TD class=3Drow=20
                      title=3D"=B1=E0=BA=C5: =
<b>356</b></br>=C0=B4=D7=D4:=BD=AD=C4=CF=D1=CE=B0=EF<br>=D7=A2=B2=E1: =
2003-7-28"><IMG=20
                        height=3D11=20
                        =
src=3D"http://25.20.176.12/bbs/images/default/ball.gif"=20
                        width=3D10> =B1=E0=BA=C5: =A1=ED356<IMG =
title=3D"=D7=B4=CC=AC =C0=EB=CF=DF"=20
                        =
src=3D"http://25.20.176.12/bbs/images/default/offline_user.gif"=20
                        align=3DabsMiddle> =
</TD></TR></TBODY></TABLE></TD>
                <TD height=3D"100%">
                  <TABLE style=3D"TABLE-LAYOUT: fixed; WORD-WRAP: =
break-word"=20
                  height=3D"100%" cellSpacing=3D0 cellPadding=3D0 =
width=3D"100%"=20
                  border=3D0>
                    <TBODY>
                    <TR>
                      <TD vAlign=3Dtop><IMG =
title=3D=D7=DC=BC=C6=C6=C0=B7=D6=A3=BA12=20
                        =
src=3D"http://25.20.176.12/bbs/images/default/agree.gif"=20
                        align=3Dright><IMG =
title=3D=D7=DC=BC=C6=C6=C0=B7=D6=A3=BA12=20
                        =
src=3D"http://25.20.176.12/bbs/images/default/agree.gif"=20
                        align=3Dright><IMG =
title=3D=D7=DC=BC=C6=C6=C0=B7=D6=A3=BA12=20
                        =
src=3D"http://25.20.176.12/bbs/images/default/agree.gif"=20
                        align=3Dright><SPAN class=3Dbold><SPAN=20
                        =
class=3Dsmalltxt>=D2=BB=B8=F6=CE=C4=B1=BE=B8=F1=CA=BD=D7=AA=BB=AF=B3=CC=D0=
=F2<BR><BR></SPAN></SPAN><BR>=D5=E2=CA=C7=D2=BB=B8=F6Linux=CF=C2=D7=A8=C3=
=C5=B8=C4=B1=E4=CE=C4=B1=BE=CE=C4=BC=FE=BB=BB=D0=D0=B7=FB=B5=C4=D0=A1=B3=CC=
=D0=F2=A3=AC<FONT=20
                        =
color=3Dblue>=B9=D8=BC=FC=D4=DA=D3=DAUnix=CF=B5=CD=B3=BA=CDDOS(Windows)=CF=
=B5=CD=B3=B4=A6=C0=ED=CE=C4=B1=BE=CE=C4=BC=FE=B5=C4=BB=BB=D0=D0=CB=F9=D3=C3=
=B5=C4=BB=BB=D0=D0=B7=FB=B2=BB=CD=AC=A3=A8=D7=A2=CA=CD=CB=B5=B5=C4=BA=DC=C7=
=E5=B3=FE=A3=A9=A1=A3</FONT><BR>=C1=ED=CD=E2=A3=AC=B3=CC=D0=F2=B5=C4=D0=A7=
=C2=CA=BA=DC=B5=CD=A3=AC=D4=AD=D2=F2=CA=C7=B7=B4=B8=B4=C0=FB=D3=C3=C1=CB=D7=
=EE=B5=CD=BC=B6=B5=C4=CF=B5=CD=B3=B5=F7=D3=C3read=BA=CDwrite=C3=BF=B4=CE=B6=
=C1=D0=B4=D2=BB=B8=F6=D7=D6=BD=DA=A3=AC=C8=B4=C3=BB=D3=D0=C0=FB=D3=C3=BB=BA=
=B3=E5=BC=BC=CA=F5=A3=AC=C3=BF=B8=F6=CF=B5=CD=B3=B5=F7=D3=C3=B5=C4=BF=AA=CF=
=FA=CA=C7=BA=DC=B4=F3=B5=C4=A3=AC=BA=CF=C0=ED=B5=C4=B7=BD=CA=BD=D3=A6=B8=C3=
=CA=C7=B2=C9=D3=C3=B1=EA=D7=BCC=BA=AF=CA=FDfgetc=BA=CDfputc=B5=C8=A3=A8=CF=
=B5=CD=B3=CA=B5=CF=D6=D5=E2=D0=A9=BA=AF=CA=FD=CA=B1=C0=FB=D3=C3=C1=CB=BB=BA=
=B3=E5=A3=A9=A3=AC=D4=AD=D2=F2=CA=C7=C4=C7=CA=B1=B8=D5=D1=A7=CE=C4=BC=FE=CF=
=B5=CD=B3=B5=C4=CF=B5=CD=B3=B5=F7=D3=C3=A3=AC=BA=C7=BA=C7=A3=AC=BB=B9=D3=D0=
=A3=AC=C4=C7=BC=B8=B8=F6if=20
                        =
else=D3=C3=B5=C4=D2=B2=B1=C8=BD=CF=C2=D2=A3=AC=D2=B2=B2=BB=CF=EB=B8=C4=C1=
=CB=A1=A3<BR><BR><BR>/* &nbsp; &nbsp; &nbsp;=20
                        &nbsp; new line:<BR>* &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp;=20
                        &nbsp; &nbsp; &nbsp; In Unix&nbsp; =
&nbsp;:&nbsp;&nbsp;it=20
                        is \n&nbsp;&nbsp;ASCII 0xA<BR>*&nbsp; &nbsp; =
&nbsp;=20
                        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; In=20
                        windows:&nbsp;&nbsp;it is \r\n&nbsp;&nbsp;ASCII =
0xD=20
                        0xA<BR>*&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp;=20
                        &nbsp; In Mac&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;=20
                        &nbsp;:&nbsp;&nbsp;it is \r&nbsp;&nbsp;ASCII=20
                        =
0xD<BR>*/<BR><BR>#include&lt;stdio.h&gt;<BR>#include&lt;stdlib.h&gt;<BR>#=
include&lt;unistd.h&gt;<BR>#include&lt;fcntl.h&gt;<BR>#include&lt;sys/typ=
es.h&gt;<BR><BR>#define=20
                        BUFSIZE 128<BR><BR>char=20
                        *tempfile=3D"/tmp/temp.txt";<BR>char =
*sfname;<BR><BR>void=20
                        Uerr(void);<BR>void err(char=20
                        *);<BR>int&nbsp;&nbsp;cUtoW(int,int,int);<BR>int =

                        cWtoU(int,int,int);<BR><BR>int main(int =
argc,char=20
                        *argv[])<BR>{<BR>&nbsp; &nbsp; int =
sfd,dfd;&nbsp; &nbsp;=20
                        /* sourse file discripter and destination file=20
                        discripter*/<BR>&nbsp; &nbsp; int creatfile=3D0; =
/* 0=20
                        means don't creat the dest file,<BR>&nbsp; =
&nbsp; &nbsp;=20
                        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; =
&nbsp;&nbsp;=20
                        &nbsp;&nbsp; &nbsp;and convert the sourse file =
directly;=20
                        <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp;=20
                        &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; */&nbsp; &nbsp; =

                        <BR>&nbsp; &nbsp; if(argc&lt;3) =
Uerr();<BR>&nbsp; &nbsp;=20
                        if(*argv[argc-1]!=3D'-') Uerr();<BR>&nbsp; =
&nbsp;=20
                        if(*argv[2]!=3D'-'){ /* means argv[2] is the =
dest filename=20
                        */<BR>&nbsp; &nbsp; &nbsp; &nbsp;=20
                        =
if((dfd=3Dopen(argv[2],O_CREAT|O_WRONLY,0666))&lt;0){<BR>&nbsp;=20
                        &nbsp; &nbsp; &nbsp;&nbsp;=20
                        &nbsp;&nbsp;&nbsp;printf("con't creat dest file=20
                        %s:",argv[2]);<BR>&nbsp; &nbsp; &nbsp; =
&nbsp;&nbsp;=20
                        &nbsp;&nbsp;&nbsp;err("");<BR>&nbsp; &nbsp; =
&nbsp;=20
                        &nbsp; }<BR>&nbsp; &nbsp; &nbsp; &nbsp;=20
                        creatfile=3D1;<BR>&nbsp; &nbsp; }<BR><BR>&nbsp; =
&nbsp;=20
                        =
if((sfd=3Dopen(argv[1],O_RDONLY))&lt;0)<BR>&nbsp; &nbsp;=20
                        &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;err("con't =
open=20
                        sourse file");<BR>&nbsp; &nbsp; &nbsp; &nbsp; =
else=20
                        ;<BR>&nbsp; &nbsp; =
if(creatfile=3D=3D0){<BR>&nbsp; &nbsp;=20
                        &nbsp; &nbsp; sfname=3Dargv[1];&nbsp; &nbsp; =
&nbsp; &nbsp;=20
                        <BR>&nbsp; &nbsp; &nbsp; &nbsp;=20
                        =
if((dfd=3Dopen(tempfile,O_CREAT|O_RDWR|O_TRUNC,0666))&lt;0)<BR>&nbsp;=20
                        &nbsp; &nbsp; &nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;err("can't=20
                        creat temp file");<BR>&nbsp; &nbsp; &nbsp; =
&nbsp;=20
                        if(unlink(tempfile)&lt;0)<BR>&nbsp; &nbsp; =
&nbsp;=20
                        &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;err("can't unlink =
temp=20
                        file");<BR>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; =
&nbsp;=20
                        <BR>&nbsp; &nbsp; }<BR>&nbsp; &nbsp;=20
                        switch(*(argv[argc-1]+1)){<BR>&nbsp; &nbsp; =
&nbsp;=20
                        &nbsp; case=20
                        'u':if(cUtoW(sfd,dfd,creatfile)&lt;0)<BR>&nbsp; =
&nbsp;=20
                        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;=20
                        &nbsp;&nbsp; &nbsp;err("convert");<BR>&nbsp; =
&nbsp;=20
                        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;=20
                        &nbsp;&nbsp;&nbsp;break;<BR>&nbsp; &nbsp; &nbsp; =
&nbsp;=20
                        case =
'w':if(cWtoU(sfd,dfd,creatfile)&lt;0)<BR>&nbsp;=20
                        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp;&nbsp;=20
                        &nbsp;&nbsp; &nbsp;err("convert");<BR>&nbsp; =
&nbsp;=20
                        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;=20
                        &nbsp;&nbsp;&nbsp;break;<BR>&nbsp; &nbsp; &nbsp; =
&nbsp;=20
                        default:Uerr();<BR>&nbsp; &nbsp; }&nbsp; &nbsp; =
&nbsp;=20
                        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
<BR>}<BR><BR>int=20
                        cUtoW(int sfd,int dfd,int flag)<BR>{<BR>&nbsp; =
&nbsp;=20
                        char c;<BR>&nbsp; &nbsp; char =
s[]=3D"\r\n";<BR>&nbsp;=20
                        &nbsp; char *buf=3DNULL;<BR>&nbsp; &nbsp; int=20
                        bytes=3D1;<BR>&nbsp; &nbsp; int newfd;<BR>&nbsp; =
&nbsp;=20
                        for(;read(sfd,&amp;c,1);){<BR>&nbsp; &nbsp; =
&nbsp;=20
                        &nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;if(c=3D=3D0xa)<BR>&nbsp;=20
                        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -