<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.6000.16587" name=GENERATOR>
<STYLE>@font-face {
font-family: ËÎÌå;
}
@font-face {
font-family: Verdana;
}
@font-face {
font-family: @ËÎÌå;
}
@page Section1 {size: 595.3pt 841.9pt; margin: 72.0pt 90.0pt 72.0pt 90.0pt; layout-grid: 15.6pt; }
P.MsoNormal {
TEXT-JUSTIFY: inter-ideograph; FONT-SIZE: 10.5pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"; TEXT-ALIGN: justify
}
LI.MsoNormal {
TEXT-JUSTIFY: inter-ideograph; FONT-SIZE: 10.5pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"; TEXT-ALIGN: justify
}
DIV.MsoNormal {
TEXT-JUSTIFY: inter-ideograph; FONT-SIZE: 10.5pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"; TEXT-ALIGN: justify
}
A:link {
COLOR: blue; TEXT-DECORATION: underline
}
SPAN.MsoHyperlink {
COLOR: blue; TEXT-DECORATION: underline
}
A:visited {
COLOR: purple; TEXT-DECORATION: underline
}
SPAN.MsoHyperlinkFollowed {
COLOR: purple; TEXT-DECORATION: underline
}
SPAN.EmailStyle17 {
FONT-WEIGHT: normal; COLOR: windowtext; FONT-STYLE: normal; FONT-FAMILY: Verdana; TEXT-DECORATION: none; mso-style-type: personal-compose
}
DIV.Section1 {
page: Section1
}
UNKNOWN {
FONT-SIZE: 10pt
}
BLOCKQUOTE {
MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; MARGIN-LEFT: 2em
}
OL {
MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
UL {
MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
</STYLE>
</HEAD>
<BODY style="FONT-SIZE: 10pt; FONT-FAMILY: verdana">
<DIV><FONT face=Verdana color=#000080 size=2> // First, determine the
length of the command line.<BR> unsigned len = 0;<BR> for (unsigned
i = 0; args[i]; i++) {<BR> len += strlen(args[i]) +
1;<BR> if (strchr(args[i], '
'))<BR> len += 2;<BR> }</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Verdana color=#000080 size=2> // Now build the command
line.<BR> char *command = reinterpret_cast<char
*>(_alloca(len)); // should use len+1 to fix
this <BR> char *p = command;</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Verdana color=#000080 size=2> for (unsigned i = 0;
args[i]; i++) {<BR> const char *arg =
args[i];<BR> size_t len = strlen(arg);<BR>
bool needsQuoting = strchr(arg, ' ') != 0;<BR> if
(needsQuoting)<BR> *p++ =
'"';<BR> memcpy(p, arg, len);<BR> p +=
len;<BR> if (needsQuoting)<BR>
*p++ = '"';<BR> *p++ = ' ';<BR> }</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Verdana color=#000080 size=2> *p =
0; // this may write beyond the boundary</FONT></DIV>
<DIV><FONT face=Verdana color=#000080 size=2></FONT> </DIV>
<DIV><FONT face=Verdana color=#000080 size=2></FONT> </DIV>
<DIV><FONT face=Verdana color=#c0c0c0 size=2>2008-01-23 </FONT></DIV><FONT
face=Verdana color=#000080 size=2>
<HR style="WIDTH: 122px; HEIGHT: 2px" align=left SIZE=2>
</FONT>
<DIV><FONT face=Verdana color=#c0c0c0 size=2><SPAN>cradnil</SPAN> </FONT></DIV>
<DIV><FONT face=Verdana size=2>
<DIV> </DIV></FONT></DIV></BODY></HTML>