?? u.htm
字號:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
</head>
<body bgcolor="#00FFFF" text="#000080">
<PRE><font size="5"><a href="a.htm">A</a> <a href="b.htm">B</a> <a href="c.htm">C</a> <a href="d.htm">D</a> <a href="e.htm">E</a> <a href="f.htm">F</a> <a href="g.htm">G</a> <a href="h.htm">H</a> <a href="i.htm">I</a> <a href="k.htm">K</a> <a href="l.htm">L</a> <a href="m.htm">M</a> <a href="n.htm">N</a> <a href="o.htm">O</a> <a href="p.htm">P</a> <a href="q.htm">Q</a> <a href="r.htm">R</a> <a href="s.htm">S</a> <a href="t.htm">T</a> <a href="u.htm">U</a> <a href="v.htm">V</a> <a href="w.htm">W</a> </font></PRE>
<PRE> </PRE>
<PRE>函數大全(u開頭)
</PRE>
<PRE>函數名:<font size="5" color="#FF0000"> ultoa </font>
功 能: 轉換一個無符號長整型數為字符串
用 法: char *ultoa(unsigned long value, char *string, int radix);
程序例: </PRE>
<PRE>#include
#include </PRE>
<PRE>int main( void )
{
unsigned long lnumber = 3123456789L;
char string[25]; </PRE>
<PRE>ultoa(lnumber,string,10);
printf("string = %s unsigned long = %lu\n",string,lnumber); </PRE>
<PRE>return 0;
}
</PRE>
<PRE>函數名: <font size="5" color="#FF0000">ungetc </font>
功 能: 把一個字符退回到輸入流中
用 法: int ungetc(char c, FILE *stream);
程序例: </PRE>
<PRE>#include
#include </PRE>
<PRE>int main( void )
{
int i=0;
char ch; </PRE>
<PRE>puts("Input an integer followed by a char:"); </PRE>
<PRE>/* read chars until non digit or EOF */
while((ch = getchar()) != EOF && isdigit(ch))
i = 10 * i + ch - 48; /* convert ASCII into int value */ </PRE>
<PRE>/* if non digit char was read, push it back into input buffer */
if (ch != EOF)
ungetc(ch, stdin); </PRE>
<PRE>printf("i = %d, next char in buffer = %c\n", i, getchar());
return 0;
}
</PRE>
<PRE>函數名: <font size="5" color="#FF0000">ungetch </font>
功 能: 把一個字符退回到鍵盤緩沖區中
用 法: int ungetch(int c);
程序例: </PRE>
<PRE>#include
#include
#include </PRE>
<PRE>int main( void )
{
int i=0;
char ch; </PRE>
<PRE>puts("Input an integer followed by a char:"); </PRE>
<PRE>/* read chars until non digit or EOF */
while((ch = getche()) != EOF && isdigit(ch))
i = 10 * i + ch - 48; /* convert ASCII into int value */ </PRE>
<PRE>/* if non digit char was read, push it back into input buffer */
if (ch != EOF)
ungetch(ch); </PRE>
<PRE>printf("\n\ni = %d, next char in buffer = %c\n", i, getch());
return 0;
}
</PRE>
<PRE>函數名:<font size="5" color="#FF0000"> unixtodos </font>
功 能: 把日期和時間轉換成DOS格式
用 法: void unixtodos(long utime, struct date *dateptr,
struct time *timeptr);
程序例: </PRE>
<PRE>#include
#include </PRE>
<PRE>char *month[] = {"---", "Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; </PRE>
<PRE>#define SECONDS_PER_DAY 86400L /* the number of seconds in one day */ </PRE>
<PRE>struct date dt;
struct time tm; </PRE>
<PRE>int main(void)
{
unsigned long val; </PRE>
<PRE>/* get today's date and time */
getdate(&dt);
gettime(&tm);
printf("today is %d %s %d\n", dt.da_day, month[dt.da_mon], dt.da_year); </PRE>
<PRE>/* convert date and time to unix format (number of seconds since Jan 1, 1970 */
val = dostounix(&dt, &tm);
/* subtract 42 days worth of seconds */
val -= (SECONDS_PER_DAY * 42); </PRE>
<PRE>/* convert back to dos time and date */
unixtodos(val, &dt, &tm);
printf("42 days ago it was %d %s %d\n",
dt.da_day, month[dt.da_mon], dt.da_year);
return 0;
}
</PRE>
<PRE>函數名: <font size="5" color="#FF0000">unlink </font>
功 能: 刪掉一個文件
用 法: int unlink(char *filename);
程序例: </PRE>
<PRE>#include
#include </PRE>
<PRE>int main(void)
{
FILE *fp = fopen("junk.jnk","w");
int status; </PRE>
<PRE>fprintf(fp,"junk"); </PRE>
<PRE>status = access("junk.jnk",0);
if (status == 0)
printf("File exists\n");
else
printf("File doesn't exist\n"); </PRE>
<PRE>fclose(fp);
unlink("junk.jnk");
status = access("junk.jnk",0);
if (status == 0)
printf("File exists\n");
else
printf("File doesn't exist\n");
</PRE>
<PRE>return 0;
}
</PRE>
<PRE>函數名: <font size="5" color="#FF0000">unlock </font>
功 能: 解除文件共享鎖
用 法: int unlock(int handle, long offset, long length);
程序例: </PRE>
<PRE>#include
#include
#include
#include
#include
#include </PRE>
<PRE>int main(void)
{
int handle, status;
long length; </PRE>
<PRE>handle = sopen("c:\\autoexec.bat",O_RDONLY,SH_DENYNO,S_IREAD); </PRE>
<PRE>if (handle < 0)
{
printf("sopen failed\n");
exit(1);
} </PRE>
<PRE>length = filelength(handle);
status = lock(handle,0L,length/2); </PRE>
<PRE>if (status == 0)
printf("lock succeeded\n");
else
printf("lock failed\n"); </PRE>
<PRE>status = unlock(handle,0L,length/2); </PRE>
<PRE>if (status == 0)
printf("unlock succeeded\n");
else
printf("unlock failed\n"); </PRE>
<PRE>close(handle);
return 0;
}
</PRE>
<PRE><font size="5"><a href="a.htm">A</a> <a href="b.htm">B</a> <a href="c.htm">C</a> <a href="d.htm">D</a> <a href="e.htm">E</a> <a href="f.htm">F</a> <a href="g.htm">G</a> <a href="h.htm">H</a> <a href="i.htm">I</a> <a href="k.htm">K</a> <a href="l.htm">L</a> <a href="m.htm">M</a> <a href="n.htm">N</a> <a href="o.htm">O</a> <a href="p.htm">P</a> <a href="q.htm">Q</a> <a href="r.htm">R</a> <a href="s.htm">S</a> <a href="t.htm">T</a> <a href="u.htm">U</a> <a href="v.htm">V</a> <a href="w.htm">W</a> </font></PRE>
<PRE>
</PRE>
<pre>資料收集:beck Copyright 2004 張求熙, All Rights Reserved</pre>
<pre><a href="mailto:Email:qiuxi1984@126.com">Email:qiuxi1984@126.com</a> QQ:35540948 </pre>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -