C语言文件操作,不会呀
把文本文件d1.dat复制到文本文件d2.dat中,要求仅复制d1.dat中的英文字符。
#include "stdio。h" void main() { FILE *in,*out; char infile[]="d1。dat",outfile[]="d2。dat"; if((in=fopen(infile,"r"))==NULL) { printf("cannot open d1。
dat\n"); return; } if((out=fopen(outfile,"w"))==NULL) { printf("cannot open d2。
dat\n"); fclose(in); return; } while(!feof(in)) { char c=fgetc(in); if(c>='A' && c<='z')fputc(c,out); } fclose(in); fclose(out); }。
答:#include "stdio.h" void main() { FILE *in,*out; char infile[]="d1.dat",outfile[]...详情>>
问:挺简单的一C函数,不过我是初学者,暂时还不会写,请好心人多多帮忙!
答:int mystrlen(char *str) { int n = 0; while (*str) { n++; str++;} return n; } voi...详情>>