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

📄 u.htm

📁 C语言函数库,包含所有的C语言函数
💻 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(&quot;string = %s unsigned long = %lu\n&quot;,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(&quot;Input an integer followed by a char:&quot;); </PRE>
<PRE>/* read chars until non digit or EOF */ 
while((ch = getchar()) != EOF &amp;&amp; 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(&quot;i = %d, next char in buffer = %c\n&quot;, 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(&quot;Input an integer followed by a char:&quot;); </PRE>
<PRE>/* read chars until non digit or EOF */ 
while((ch = getche()) != EOF &amp;&amp; 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(&quot;\n\ni = %d, next char in buffer = %c\n&quot;, 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[] = {&quot;---&quot;, &quot;Jan&quot;, &quot;Feb&quot;, &quot;Mar&quot;, &quot;Apr&quot;, &quot;May&quot;, &quot;Jun&quot;, 
&quot;Jul&quot;, &quot;Aug&quot;, &quot;Sep&quot;, &quot;Oct&quot;, &quot;Nov&quot;, &quot;Dec&quot;}; </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(&amp;dt); 
gettime(&amp;tm); 
printf(&quot;today is %d %s %d\n&quot;, 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(&amp;dt, &amp;tm); 
/* subtract 42 days worth of seconds */ 
val -= (SECONDS_PER_DAY * 42); </PRE>
<PRE>/* convert back to dos time and date */ 
unixtodos(val, &amp;dt, &amp;tm); 
printf(&quot;42 days ago it was %d %s %d\n&quot;, 
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(&quot;junk.jnk&quot;,&quot;w&quot;); 
int status; </PRE>
<PRE>fprintf(fp,&quot;junk&quot;); </PRE>
<PRE>status = access(&quot;junk.jnk&quot;,0); 
if (status == 0) 
printf(&quot;File exists\n&quot;); 
else 
printf(&quot;File doesn't exist\n&quot;); </PRE>
<PRE>fclose(fp); 
unlink(&quot;junk.jnk&quot;); 
status = access(&quot;junk.jnk&quot;,0); 
if (status == 0) 
printf(&quot;File exists\n&quot;); 
else 
printf(&quot;File doesn't exist\n&quot;); 
</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(&quot;c:\\autoexec.bat&quot;,O_RDONLY,SH_DENYNO,S_IREAD); </PRE>
<PRE>if (handle &lt; 0) 
{ 
printf(&quot;sopen failed\n&quot;); 
exit(1); 
} </PRE>
<PRE>length = filelength(handle); 
status = lock(handle,0L,length/2); </PRE>
<PRE>if (status == 0) 
printf(&quot;lock succeeded\n&quot;); 
else 
printf(&quot;lock failed\n&quot;); </PRE>
<PRE>status = unlock(handle,0L,length/2); </PRE>
<PRE>if (status == 0) 
printf(&quot;unlock succeeded\n&quot;); 
else 
printf(&quot;unlock failed\n&quot;); </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 + -