What is the proper procedure to "Delete" information either from the end of a Binary File or from the middle of a File. Have tried inserting "" and " " but neither seems to work... Thanks for your help
Keith
Binary FileDeleting from the file
Page 1 of 1
5 Replies - 1280 Views - Last Post: 22 September 2010 - 11:26 AM
Replies To: Binary File
#2
Re: Binary File
Posted 14 September 2010 - 10:08 AM
One way would be to "copy" the bits you need (i.e.: read it in and write it out, discarding the bits you don't need).
This will do as you you said you wanted to do, but depending on what the binary file is, it may not achieve what you want, for example if it's an exe file, deleting bits from here there and everywhere would probably break it.
If you give some more details of the what the file is and what your actually trying to achieve and the code you've written so far, your more likely to get a response tailored to what your after.
This will do as you you said you wanted to do, but depending on what the binary file is, it may not achieve what you want, for example if it's an exe file, deleting bits from here there and everywhere would probably break it.
If you give some more details of the what the file is and what your actually trying to achieve and the code you've written so far, your more likely to get a response tailored to what your after.
#3 Guest_kmoffitt*
Re: Binary File
Posted 22 September 2010 - 06:51 AM
this is deleting a "password"; sometimes to just delete or remove the password and other times to replace the password with a shorter or longer one...
maj3091, on 14 September 2010 - 09:08 AM, said:
One way would be to "copy" the bits you need (i.e.: read it in and write it out, discarding the bits you don't need).
This will do as you you said you wanted to do, but depending on what the binary file is, it may not achieve what you want, for example if it's an exe file, deleting bits from here there and everywhere would probably break it.
If you give some more details of the what the file is and what your actually trying to achieve and the code you've written so far, your more likely to get a response tailored to what your after.
This will do as you you said you wanted to do, but depending on what the binary file is, it may not achieve what you want, for example if it's an exe file, deleting bits from here there and everywhere would probably break it.
If you give some more details of the what the file is and what your actually trying to achieve and the code you've written so far, your more likely to get a response tailored to what your after.
#4
Re: Binary File
Posted 22 September 2010 - 07:12 AM
kmoffitt, on 22 September 2010 - 05:51 AM, said:
this is deleting a "password"; sometimes to just delete or remove the password and other times to replace the password with a shorter or longer one...
maj3091, on 14 September 2010 - 09:08 AM, said:
One way would be to "copy" the bits you need (i.e.: read it in and write it out, discarding the bits you don't need).
This will do as you you said you wanted to do, but depending on what the binary file is, it may not achieve what you want, for example if it's an exe file, deleting bits from here there and everywhere would probably break it.
If you give some more details of the what the file is and what your actually trying to achieve and the code you've written so far, your more likely to get a response tailored to what your after.
This will do as you you said you wanted to do, but depending on what the binary file is, it may not achieve what you want, for example if it's an exe file, deleting bits from here there and everywhere would probably break it.
If you give some more details of the what the file is and what your actually trying to achieve and the code you've written so far, your more likely to get a response tailored to what your after.
This again goes back to my original statement of "it depends on what the file is".
Is it you're own binary file?
Did you write the program that reads it?
For example, if the program trying to read the file, reads it into a UDT, where the password field is expected to be a certain length, then you can't make it longer. If you make it shorter, you will need to pad it with something, but then do you pad it left or right? Do you understand what I'm trying to say?
An explanation of one way of doing what you wanted was given in my previous post, so you can quite easily achieve the aim of your question. Whether it works will be dependant on the file and the programs that utilise it.
Have a go at writing some code and see how you get on.
#5 Guest_kmoffitt*
Re: Binary File
Posted 22 September 2010 - 08:54 AM
Yes this is my binary file; the password in this case is at the end of the file. I always know the length of the old password or the new one or the one I am deleting; it is held in a variable and I know the length of the varible. I don't know how to take the old password out of the file and just leave "nothing" in its place...
Thanks
This again goes back to my original statement of "it depends on what the file is".
Is it you're own binary file?
Did you write the program that reads it?
For example, if the program trying to read the file, reads it into a UDT, where the password field is expected to be a certain length, then you can't make it longer. If you make it shorter, you will need to pad it with something, but then do you pad it left or right? Do you understand what I'm trying to say?
An explanation of one way of doing what you wanted was given in my previous post, so you can quite easily achieve the aim of your question. Whether it works will be dependant on the file and the programs that utilise it.
Have a go at writing some code and see how you get on.
Thanks
maj3091, on 22 September 2010 - 06:12 AM, said:
kmoffitt, on 22 September 2010 - 05:51 AM, said:
this is deleting a "password"; sometimes to just delete or remove the password and other times to replace the password with a shorter or longer one...
maj3091, on 14 September 2010 - 09:08 AM, said:
One way would be to "copy" the bits you need (i.e.: read it in and write it out, discarding the bits you don't need).
This will do as you you said you wanted to do, but depending on what the binary file is, it may not achieve what you want, for example if it's an exe file, deleting bits from here there and everywhere would probably break it.
If you give some more details of the what the file is and what your actually trying to achieve and the code you've written so far, your more likely to get a response tailored to what your after.
This will do as you you said you wanted to do, but depending on what the binary file is, it may not achieve what you want, for example if it's an exe file, deleting bits from here there and everywhere would probably break it.
If you give some more details of the what the file is and what your actually trying to achieve and the code you've written so far, your more likely to get a response tailored to what your after.
This again goes back to my original statement of "it depends on what the file is".
Is it you're own binary file?
Did you write the program that reads it?
For example, if the program trying to read the file, reads it into a UDT, where the password field is expected to be a certain length, then you can't make it longer. If you make it shorter, you will need to pad it with something, but then do you pad it left or right? Do you understand what I'm trying to say?
An explanation of one way of doing what you wanted was given in my previous post, so you can quite easily achieve the aim of your question. Whether it works will be dependant on the file and the programs that utilise it.
Have a go at writing some code and see how you get on.
#6
Re: Binary File
Posted 22 September 2010 - 11:26 AM
In that case, if you know the length, then you can read it byte by byte and write it out for the length of the original file - length of your password.
Have a look at THIS tutorial, maybe it will get you started.
Have a go at some code and post back if you have problems.
Have a look at THIS tutorial, maybe it will get you started.
Have a go at some code and post back if you have problems.
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote



|