📄 fileno.c
字号:
#include <stdio.h>
#include <io.h>
#include <fcntl.h>
#include <alloc.h>
#include <stdlib.h>
void main()
{
int handle;
FILE *stream;
int offset=0;
int length;
void *buf;
buf=malloc(60000);
if (buf==NULL)
{
printf("out of memory");
exit(1);
}
stream=fopen("c:\\autoexec.bat","rt");
if (stream==NULL)
{
printf("open failed");
exit(1);
}
handle=fileno(stream);
length=read(handle,buf,60000); // 佬绢 甸烙
if (length==-1)
{
printf("reading error");
exit(1);
}
for (offset=0;offset<length;offset++) // 免仿
putchar(((char *)buf)[offset]);
close(handle);
fclose(stream);
free(buf);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -