标签:targe can 文件 blog include article putchar clu oid
可以用open和fopen来打开文件,open偏底层,fopen来自于open更顶层。(根据公司某个项目看了源码用的open)
#include <stdio.h>
#include <windows.h>
int main(void)
{
FILE *fp;
char temp;
char buf[100];
if((fp=fopen("com3","r"))==NULL)
puts("Can‘t open com3 /n");
while(1)
{
temp=0;
fscanf(fp,"%c",&temp);
if(temp!=0)
putchar(temp);
else
Sleep(100);
}
fclose(fp);
return 0;
}
代码转自:http://blog.csdn.net/codexy/article/details/5390550
标签:targe can 文件 blog include article putchar clu oid
原文地址:http://www.cnblogs.com/judes/p/7016605.html