在Linux上这个代码的作品。 它从文件(文件大小= 200000字节)中读取50000个整数。 但在Visual Studio 2015 fread返回73.我不明白为什么?
安慰:
Oops. Can not read successfully the stack. size = 50000 rsize = 73 filename = nums Size of int = 4 Better to STOP Press any key to continue . . .
代码片段:
FILE* f = fopen(fn,"r"); if (f == NULL) { printf("nCan not open file %sn",fn); return 1; } int* stack = malloc(sizeof(int) * size); if (stack == NULL) { fclose(f); printf("nCan not stack the stack - not enough memoryn"); return 2; } int rsize = fread(stack,sizeof(int),size,f); if (size != rsize) { printf("nOops. Can not read successfully the stack.n size = %dnrsize = %dnfilename = %snSize of int = %dnBetter to STOPn",rsize,fn,sizeof(int)); fclose(f); free(stack); return 3; }
用MFC创build一个WM_USER处理程序
如何使用C#在WPF中创build2个独立的窗口
可以检索Windows待机定时器吗?
FPO数据和系统DLL
如何读取和写入Windows“networking位置”
用C#挑选某个数组的string
Windows Server不能执行一个py2exe生成的应用程序
我怎样才能得到一个远程(即不在我的进程内)线程的堆栈跟踪?
Anaconda Python 32位正试图加载Anaconda 64位库
当打开文件时,你可能需要设置二进制模式“rb”,否则它将作为文本文件(在Windows中)与Linux中的二进制文件打开。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。