473,326 Members | 2,182 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

delete record from binary file in c++

1
How To Delete A Record From binary File - C++ ?
Jan 12 '13 #1
1 4552
weaknessforcats
9,208 Expert Mod 8TB
You have to know the format of the binary file. Otherwise you can do nothing.

Then you create a new binary file and copy the old file to it up to where the delete starts then skip to where the delete ends and copy the rest of the file.

Then copy the new file back on top of the old file and then delete the new file.

Note that this is almost never done. Instead, you design a file system that has one character designated as a "deleted character" and then you can replace your deleted record with these deleted characters. This assumes all of the file handling recognizes this "deleted character" and ignores them.
Jan 12 '13 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Someonekicked | last post by:
I have a binary file, and I need to delete a specific number of characters in it. The file contains records, each record has a specific length. So the way I wanna handle deleting is that I will...
17
by: Arnold | last post by:
Is using fseek and ftell a reliable method of getting the file size on a binary file? I thought I remember reading somewhere it wasn't... If not what would be the "right" and portable method to...
3
by: Matt Laver | last post by:
Hi, I have a binary file that I'm currently reading byte by byte using code similiar to: string FileName = @"c:\myFile.dat"; FileStream fs = new FileStream(FileName, FileMode.Open,...
68
by: vim | last post by:
hello everybody Plz tell the differance between binary file and ascii file............... Thanks in advance vim
9
by: Use*n*x | last post by:
Hello, I have a binary file (image file) and am reading 4-bytes at a time. The File size is 63,480,320 bytes. My assumption is that if I loop through this file reading 4 bytes at a time, I...
13
by: swetha | last post by:
HI Every1, I have a problem in reading a binary file. Actually i want a C program which reads in the data from a file which is in binary format and i want to update values in it. The file...
1
by: jennjgo | last post by:
Hi! ^.^ I am making a program but I can't continue because there's something wrong... #include<iostream> #include<string> #include<fstream> using namespace std;
2
by: jhansi | last post by:
create a binary file and insert the records and query on those inserted record.. queries are: query based on search by name,search by age and search by designation. the problem is i have...
0
by: bitbyte89 | last post by:
void delData() { int id; fstream delData("Department1.txt",ios::out | ios::in|ios::binary); if(!delData) { cerr<<"file could not be opened"<<"\n"; } else
2
by: brixton | last post by:
Hello, I've got the following code: wxString path = filepath; wxString newpath = filepath; fstream f(path.Append("/tests/tests.bin"), ios::in | ios::binary); fstream...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.