发布网友 发布时间:2022-04-25 08:20
共1个回答
热心网友 时间:2023-11-08 18:20
#include <stdio.h>
#include <stdlib.h>
FILE *fout;
void main (int argc, char *argv[])
{
char nameout[72];
int i,j,k=0;
strcpy(nameout,"ASCII_TABLE.TMP");
if ( (fout = fopen(nameout,"wb") ) == NULL ) {
printf("\007Cann't open output file: %s ", nameout);exit(1);
};
k = 0;
for (j= 0x10; j <= 0x100 ;j=j+1) {
// check: fprintf(fout,"%03x ",j);
fputc(j,fout); fprintf(fout," ");
k = k + 1;
if ( k % 16 == 0) fprintf(fout,"\n");
};
fclose(fout);
printf("Output in %s\n", nameout);
exit(0);
}
用MS VC++ 编译器编译并试验了,程序正确。