📄 fc.htm
字号:
程序例: </p>
<p>#include <stdio.h> <br>
#include <alloc.h> </p>
<p>int main(void) <br>
{ <br>
printf("The difference between the
highest allocated block and\n"); <br>
printf("the top of the heap is: %lu
bytes\n", (unsigned long) coreleft()); </p>
<p> return 0; <br>
} <br>
</p>
<p>函数名: cos <br>
功 能: 余弦函数 <br>
用 法: double cos(double x); <br>
程序例: </p>
<p>#include <stdio.h> <br>
#include <math.h> </p>
<p>int main(void) <br>
{ <br>
double result; <br>
double x = 0.5; </p>
<p> result = cos(x); <br>
printf("The cosine of %lf is
%lf\n", x, result); <br>
return 0; <br>
} <br>
<br>
<br>
</p>
<p>函数名: cosh <br>
功 能: 双曲余弦函数 <br>
用 法: dluble cosh(double x); <br>
程序例: </p>
<p>#include <stdio.h> <br>
#include <math.h> </p>
<p>int main(void) <br>
{ <br>
double result; <br>
double x = 0.5; </p>
<p> result = cosh(x); <br>
printf("The hyperboic cosine of %lf is
%lf\n", x, result); <br>
return 0; <br>
} <br>
<br>
<br>
</p>
<p>函数名: country <br>
功 能: 返回与国家有关的信息 <br>
用 法: struct COUNTRY *country(int countrycode,
struct country *country); <br>
程序例: </p>
<p>#include <dos.h> <br>
#include <stdio.h> </p>
<p>#define USA 0 </p>
<p>int main(void) <br>
{ <br>
struct COUNTRY country_info; </p>
<p> country(USA, &country_info); <br>
printf("The currency symbol for the USA
is: %s\n", <br>
country_info.co_curr); <br>
return 0; <br>
} <br>
<br>
<br>
</p>
<p>函数名: cprintf <br>
功 能: 送格式化输出至屏幕 <br>
用 法: int cprintf(const char *format[, argument,
...]); <br>
程序例: </p>
<p>#include <conio.h> </p>
<p>int main(void) <br>
{ <br>
/* clear the screen */ <br>
clrscr(); </p>
<p> /* create a text window */ <br>
window(10, 10, 80, 25); </p>
<p> /* output some text in the window */ <br>
cprintf("Hello world\r\n"); </p>
<p> /* wait for a key */ <br>
getch(); <br>
return 0; <br>
} <br>
<br>
<br>
</p>
<p>函数名: cputs <br>
功 能: 写字符到屏幕 <br>
用 法: void cputs(const char *string); <br>
程序例: </p>
<p>#include <conio.h> </p>
<p>int main(void) <br>
{ <br>
/* clear the screen */ <br>
clrscr(); </p>
<p> /* create a text window */ <br>
window(10, 10, 80, 25); </p>
<p> /* output some text in the window */ <br>
cputs("This is within the
window\r\n"); </p>
<p> /* wait for a key */ <br>
getch(); <br>
return 0; <br>
} <br>
<br>
<br>
</p>
<p>函数名: _creat creat <br>
功 能:
创建一个新文件或重写一个已存在的文件 <br>
用 法: int creat (const char *filename, int
permiss); <br>
程序例: </p>
<p>#include <sys\stat.h> <br>
#include <string.h> <br>
#include <fcntl.h> <br>
#include <io.h> </p>
<p>int main(void) <br>
{ <br>
int handle; <br>
char buf[11] = "0123456789"; </p>
<p> /* change the default file mode from text
to binary */ <br>
_fmode = O_BINARY; </p>
<p> /* create a binary file for reading and
writing */ <br>
handle = creat("DUMMY.FIL",
S_IREAD | S_IWRITE); </p>
<p> /* write 10 bytes to the file */ <br>
write(handle, buf, strlen(buf)); </p>
<p> /* close the file */ <br>
close(handle); <br>
return 0; <br>
} <br>
</p>
<p>函数名: creatnew <br>
功 能: 创建一个新文件 <br>
用 法: int creatnew(const char *filename, int
attrib); <br>
程序例: </p>
<p>#include <string.h> <br>
#include <stdio.h> <br>
#include <errno.h> <br>
#include <dos.h> <br>
#include <io.h> </p>
<p>int main(void) <br>
{ <br>
int handle; <br>
char buf[11] = "0123456789"; </p>
<p> /* attempt to create a file that doesn't
already exist */ <br>
handle = creatnew("DUMMY.FIL", 0);
</p>
<p> if (handle == -1) <br>
printf("DUMMY.FIL
already exists.\n"); <br>
else <br>
{ <br>
printf("DUMMY.FIL
successfully created.\n"); <br>
write(handle, buf,
strlen(buf)); <br>
close(handle); <br>
} <br>
return 0; <br>
} <br>
<br>
<br>
</p>
<p>函数名: creattemp <br>
功 能:
创建一个新文件或重写一个已存在的文件 <br>
用 法: int creattemp(const char *filename, int
attrib); <br>
程序例: </p>
<p>#include <string.h> <br>
#include <stdio.h> <br>
#include <io.h> </p>
<p>int main(void) <br>
{ <br>
int handle; <br>
char pathname[128]; </p>
<p> strcpy(pathname, "\\"); </p>
<p> /* create a unique file in the root
directory */ <br>
handle = creattemp(pathname, 0); </p>
<p> printf("%s was the unique file
created.\n", pathname); <br>
close(handle); <br>
return 0; <br>
} <br>
<br>
<br>
</p>
<p>函数名: cscanf <br>
功 能: 从控制台执行格式化输入 <br>
用 法: int cscanf(char *format[,argument, ...]); <br>
程序例: </p>
<p>#include <conio.h> </p>
<p>int main(void) <br>
{ <br>
char string[80]; </p>
<p> /* clear the screen */ <br>
clrscr(); </p>
<p> /* Prompt the user for input */ <br>
cprintf("Enter a string with no
spaces:"); </p>
<p> /* read the input */ <br>
cscanf("%s", string); </p>
<p> /* display what was read */ <br>
cprintf("\r\nThe string entered is:
%s", string); <br>
return 0; <br>
} <br>
<br>
<br>
</p>
<p>函数名: ctime <br>
功 能: 把日期和时间转换为字符串 <br>
用 法: char *ctime(const time_t *time); <br>
程序例: </p>
<p>#include <stdio.h> <br>
#include <time.h> </p>
<p>int main(void) <br>
{ <br>
time_t t; </p>
<p> time(&t); <br>
printf("Today's date and time:
%s\n", ctime(&t)); <br>
return 0; <br>
} <br>
<br>
<br>
</p>
<p>函数名: ctrlbrk <br>
功 能: 设置Ctrl-Break处理程序 <br>
用 法: void ctrlbrk(*fptr)(void); <br>
程序例: </p>
<p>#include <stdio.h> <br>
#include <dos.h> </p>
<p>#define ABORT 0 </p>
<p>int c_break(void) <br>
{ <br>
printf("Control-Break pressed.
Program aborting ...\n"); <br>
return (ABORT); <br>
} </p>
<p>int main(void) <br>
{ <br>
ctrlbrk(c_break); <br>
for(;;) <br>
{ <br>
printf("Looping...
Press <Ctrl-Break> to quit:\n"); <br>
} <br>
return 0; <br>
} <br>
</p>
</td>
</tr>
</table>
</center></div><div align="center"><center>
<table border="0" cellspacing="1" width="640">
<tr>
<td class="p9" height="60"> <script>document.write("<p><a href=\"http://view.gznet.com/cgi-bin/rl_views.cgi?UID=10013421\" target=sxrl>");
document.write("<img src=\"http://refer.gznet.com/cgi-bin/rl_refer2.cgi?UID=10013421&refer="+escape(top.document.referrer)+"\" width=1 height=1 border=0 alt=\" \">");
document.write("</a>");
</script></td>
</tr>
</table>
</center></div>
<p> </p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -