69,371
社区成员
发帖
与我相关
我的任务
分享
#include <stdio.h>
void main(void)
{
FILE *fp;
fp=fopen("E:\\c\\大明.txt","r");
char cl;
do
{
cl = fgetc(fp);
//如何从内存获得文字的二进制码
}
while (cl != EOF);
fclose(fp);
}
#include <stdio.h>
#include <stdlib.h>
void main() {
FILE *fp;
int cl;
char bs[33];
char b[33];
fp=fopen("E:\\c\\大明.txt","rb");
if (fp) {
while (1) {
cl = fgetc(fp);
if (EOF==cl) break;
_itoa(cl,b,2);
sprintf(bs,"%032s",b);
printf("%s ",bs+24);
}
fclose(fp);
} else {
printf("Can not open file E:\\c\\大明.txt\n");
}
}
unsigned char a[3]="我";
printf("%c%c",a[0],a[1]);
unsigned char a[3]="我";
printf("%2X%2X",a[0],a[1]);