Я использую двоичный файл для обновления записи, код:
file.seekp (file.tellp () - SizeOf (* это));
показывает строку ошибки под знаком минус.
Сообщение об ошибке:
Ошибка C2666 'std :: fpos <_Mbstatet> :: operator -': 3 перегрузки имеют похожие преобразования BarbershopDemo c: \ users ... \ employeeinfo.cpp 133
void Employee::updateEmployee(char *t) {
fstream file;
file.open("file1.dat", ios::in | ios::out | ios::ate | ios::binary);
file.seekg(0);
file.read((char*)this, sizeof(*this));
while (!file.eof()) {
if (!strcmp(t, eFirstName)) {
getEmployeeData();
file.seekp(file.tellp()-sizeof(*this));
file.write((char*)this, sizeof(*this));
}
file.read((char*)this, sizeof(*this));
}
file.close();
}
void Employee::updateEmployee(char *t) {
fstream file;
file.open("file1.dat", ios::in | ios::out | ios::ate | ios::binary);
file.seekg(0);
file.read((char*)this, sizeof(*this));
while (!file.eof()) {
if (!strcmp(t, eFirstName)) {
getEmployeeData();
file.seekp(file.tellp()-sizeof(*this));
file.write((char*)this, sizeof(*this));
}
file.read((char*)this, sizeof(*this));
}
file.close();
}
Я не уверен, что является причиной ошибки. Спасибо за помощь.
что я включил в свой проект.
#include "stdafx.h"
#include "EmployeeInfo.h"
#include<iostream>
#include <string.h>
#include <fstream>
#include<stdio.h>
#include<conio.h>
using namespace std;