这是我的问题的描述:
我想读取一个大的文件,大约6.3GB,所有内存使用readC中的系统调用,但发生错误.这是代码:
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <assert.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <limits.h>
int main(int argc, char* argv[]) {
int _fd = open(argv[1], O_RDONLY, (mode_t) 0400);
if (_fd == -1)
return 1;
off_t size = lseek(_fd, 0, SEEK_END);
printf("total size: %lld\n", size);
lseek(_fd, 0, SEEK_SET);
char *buffer = malloc(size);
assert(buffer);
off_t total = 0;
ssize_t ret = read(_fd, buffer, size);
if (ret != size) {
printf("read fail, %lld, reason:%s\n", …Run Code Online (Sandbox Code Playgroud) 我正在尝试将一些数据添加到app引擎数据存储区中.这是我的功能
(defn createUser [email phone roleId status]
(println (db/isIdExist "users" "email" email))
(if (db/isIdExist "users" "email" email)
(str "false")
((db/addUser email phone roleId status) (str "true"))))
Run Code Online (Sandbox Code Playgroud)
在这里我想根据isIdExist函数的值打印false (如果电子邮件已经存在,则返回true,否则为false)现在当我运行它时,如果isIdExist == true那时它打印为false但是当isIdExist == false它在数据存储区中添加值但是给出了这个错误.有人可以帮助为什么会发生这种情况,我在这里错过了什么概念?谢谢