| C语言库函数(C类字母) |
|
| 作者:未知 文章来源:网络收集 点击数: 更新时间:2006-3-29 15:22:24
|
from text to binary */ _fmode = O_BINARY;
/* create a binary file for reading and writing */ handle = creat("DUMMY.FIL", S_IREAD | S_IWRITE);
/* write 10 bytes to the file */ write(handle, buf, strlen(buf));
/* close the file */ close(handle); return 0; }
函数名: creatnew 功 能: 创建一个新文件 用 法: int creatnew(const char *filename, int attrib); 程序例:
#include #include #include #include #include
int main(void) { int handle; char buf[11] = "0123456789";
/* attempt to create a file that doesn't already exist */ handle = creatnew("DUMMY.FIL", 0);
if (handle == -1) printf("DUMMY.FIL already exists.\n"); else { printf("DUMMY.FIL successfully created.\n"); write(handle, buf, strlen(buf)); close(handle); } return 0; }
函数名: creattemp 功 能: 创建一个新文件或重写一个已存在的文件 用 法: int creattemp(const char *filename, int attrib); 程序例:
#include #include #include
int main(void) { int handle; char pathname[128];
strcpy(pathname, "\\");
/* create a unique file in the root directory */ handle = creattemp(pathname, 0);
printf("%s was the unique file created.\n", pathname); close(handle); return 0; }
函数名: cscanf 功 能: 从控制台执行格式化输入 用 法: int cscanf(char *format[,argument, ...]); 程序例:
#include
int main(void) { char string[80];
/* clear the screen */ clrscr();
/* Prompt the user for input */ cprintf("Enter a string with no spaces:");
/* read the input */ cscanf("%s", string);
/* display what was read */ cprintf("\r\nThe string entered is: %s", string); return 0; }
函数名: ctime 功 能: 把日期和上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] 下一页
|
|
[ 收藏此页到: 天天|和讯|博采|ViVi|狐摘|我摘|天极 ] 文章录入:kinda 责任编辑:kinda |
|
上一篇文章: C语言库函数(B类字母) 下一篇文章: C语言库函数(D类字母) |
| 【字体:小 大】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口】 |