?? pc機接收子程序.c
字號:
void receivef(char *fname)
{FILE *fp;
char ch;
int count,temp,sum=0;
remove(fname);
if((fp=fopen(fname,"w"))==NULL)
{printf("不能打開文件\n");
exit(1);
}
printf("接收文件名:%s\n",fname);
while(rport()!='?');
sport('$');
ch='.';
sport(ch);
temp=report();
count=temp;
rep:
for(;count;count--)
{ch=rport();
putc(ch,fp);
sum=sum+ch;
if(ferror(fp))
{printf("寫文件有誤\n");
exit(1);
}
}
if(rport()!=sum)
{ch='F';
sport(ch);
count=temp;
sum=0;
fseek(fp,-count,1);
goto rep;
}
else
{ch='0';
sport(ch);
fclose(fp);
printf("接收文件結束\n");
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -