Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
File 管理c+上的文件+;(读)_File_C++11 - Fatal编程技术网

File 管理c+上的文件+;(读)

File 管理c+上的文件+;(读),file,c++11,File,C++11,为什么当我尝试读取存档文件时,它没有将我的值注册到程序的值中 这是我的代码: void db::cargar(){ l.open("db.txt", ios::binary); if(!l){ cout << "No se puede abrir la base de datos" << endl; }else{ cout << "Carga exitosa!!!" << endl;

为什么当我尝试读取存档文件时,它没有将我的值注册到程序的值中

这是我的代码:

void db::cargar(){
    l.open("db.txt", ios::binary);
    if(!l){
        cout << "No se puede abrir la base de datos" << endl;
    }else{
        cout << "Carga exitosa!!!" << endl;
        l.read(reinterpret_cast<char *>(&a), sizeof(a));
        while(!l.eof()){
            cout << a << endl << endl;
            l.read(reinterpret_cast<char *>(&a), sizeof(a));
        }
    }
    l.close();
}
void db::cargar(){
l、 打开(“db.txt”,ios::binary);
如果(!l){
库特
void db::mostrar(){
    temp = primero;
    if(!primero){
        cout << "No hay trabajos registrados" << endl;
    }else{
        while(temp != 0){
            a = temp->getD();
            cout << a << endl << endl;
            temp = temp->getP();
        }
    }
}