fileOps.cpp
/*
* function to delete a record
* rewrites the data file
* but without the specific line w/ your data
*/
function to delete a record
rewrites the data file
but without the specific line w/ your data
function to delete a record rewrites the data file but without the specific line w / your data
void delete_record(int n)
{
	Student obj;
	ifstream inFile;
	inFile.open("student.dat", ios::binary);
	ofstream outFile;
	outFile.open("temp.dat", ios::out | ios::binary);
	while (inFile.read((char*)&obj, sizeof(obj)))
	{
		if (obj.getAdmno() != n)
		{
			outFile.write((char*)&obj, sizeof(obj));
		}
	}
	inFile.close();
	outFile.close();
	remove("student.dat");
	rename("temp.dat", "student.dat");
}
void delete_record ( int n ) { Student obj ; ifstream inFile ; inFile . open ( " " , ios :: binary ) ; ofstream outFile ; outFile . open ( " " , ios :: out | ios :: binary ) ; while ( inFile . read ( ( char * ) & obj , sizeof ( obj ) ) ) { if ( obj . getAdmno ( ) != n ) { outFile . write ( ( char * ) & obj , sizeof ( obj ) ) ; } } inFile . close ( ) ; outFile . close ( ) ; remove ( " " ) ; rename ( " " , " " ) ; }
function to delete a record
rewrites the data file
but without the specific line w/ your data
function to delete a record rewrites the data file but without the specific line w / your data
// everything but my specific primary key
