473,508 Members | 2,226 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

change end of binary files(change size of file)

2 New Member
Hi everyone!
How we can change the end of binary files?for example we have a file contains 6 recorde and each recorde is 10 byte(size of file is 60byte).I want to delete the last recorde,I want to set the file seek on 50th byte and make here end of my file that means I want to delete the last 10 byte and change size of file to 50 byte.how can I do this?(I now other ways to delete one recorde,please dont commend other ways!!!)
thank you
bye for now
Jan 17 '09 #1
3 3773
JosAH
11,448 Recognized Expert MVP
@reddevils2020
See if your library implements the truncate() or ftruncate() function; those functions are not part of the Standard Library. If those functions aren't implemented (nor any variations thereof) you have to copy the first five records to another file, delete the first file and rename the other file again.

kind regards,

Jos
Jan 17 '09 #2
reddevils2020
2 New Member
those functions did not work and i said i now another ways!!!!
anyway thank for your help
Jan 18 '09 #3
weaknessforcats
9,208 Recognized Expert Moderator Expert
Yes, use your other ways. Of course, I won't comment per your request.
Jan 18 '09 #4

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

Similar topics

0
8223
by: chris | last post by:
I'm writing a small app to help me learn more about cryptography. All it does is encrypt all of the files in directory A, and put the encrypted versions of the files in directory B. It then...
0
1250
by: john_phx | last post by:
I'm trying to increase the performance of a program that concatenates binary file parts into a single file. Each of the parts is contained in a binary file. The existing app simply takes the first...
7
4203
by: laclac01 | last post by:
So I am converting some matlab code to C++. I am stuck at one part of the code. The matlab code uses fread() to read in to a vector a file. It's a binary file. The vector is made up of floats,...
17
15953
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...
12
5835
by: Adam J. Schaff | last post by:
I am writing a quick program to edit a binary file that contains file paths (amongst other things). If I look at the files in notepad, they look like: ...
68
5156
by: vim | last post by:
hello everybody Plz tell the differance between binary file and ascii file............... Thanks in advance vim
4
9531
by: Florence | last post by:
How can a binary file be distinguished from a text file on Windows? Obviously I want a way that is more sophisicated that just looking at the dot extention in the filename. I want to write...
10
13839
by: chat | last post by:
Hi, I know that text file ended with EOF mark but there is no mark for binary file. So, the problem is how do we know the end of binary file is reach? This code can tell us when the end of file...
7
3397
by: Ludo | last post by:
Hi, I'm working on an open source project and I have a problem with a binary file. When I read the binary file with the program downloaded from sourceforge, I have no problem. However, I'm unable...
10
22588
by: rory | last post by:
I can't seem to append a string to the end of a binary file. I'm using the following code: fstream outFile("test.exe", ios::in | ios::out | ios::binary | ios::ate | ios::app)...
0
7123
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7326
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7383
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7046
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7498
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5627
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5053
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
3182
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.