我无法弄清楚为什么我的while循环不起作用.代码在没有它的情况下正常工作......代码的目的是在bin文件中查找秘密消息.所以我得到了代码来查找字母,但现在当我尝试将其循环到文件末尾时,它不起作用.我是新来的.我究竟做错了什么?
main(){
FILE* message;
int i, start;
long int size;
char keep[1];
message = fopen("c:\\myFiles\\Message.dat", "rb");
if(message == NULL){
printf("There was a problem reading the file. \n");
exit(-1);
}
//the first 4 bytes contain an int that tells how many subsequent bytes you can throw away
fread(&start, sizeof(int), 1, message);
printf("%i \n", start); //#of first 4 bytes was 280
fseek(message, start, SEEK_CUR); //skip 280 bytes
keep[0] = fgetc(message); //get next character, keep it
printf("%c", keep[0]); //print character
while( (keep[0] = …Run Code Online (Sandbox Code Playgroud) 我刚开始学习python,我写了这三行代码:
points = 49
total = points / 50 * 500 + 40
print "omg wtf ", total
Run Code Online (Sandbox Code Playgroud)
而且我预计输出会像530一样,但相反,无论我做什么,我都会得到40.我尝试将total初始化为0,将赋值转换为int,我抛出一个括号括号,但没有任何效果.我很困惑......有人可以帮我/告诉我到底发生了什么事吗?