Convert a binary file to letters.
- Michael Vogel
- Addict
- Posts: 2797
- Joined: Thu Feb 09, 2006 11:27 pm
- Contact:
Re: Convert a binary file to letters.
So my code above should work fine using the ReadByte() function - vinostien seems to have mixed-up the names for 'bits' and 'bytes' at one of his first posts
Re: Convert a binary file to letters.
Hi, thanks alot, that seams to be what I am looking for in a code, thanks again.
vinostien
I will try to explain why I need to try this/or read this file, I work as a thieft provenction officer for 12 buildings with (for youe eyes only) info in them, this file is one day tracking of badge numbers access panels, key pads and prox sencers, this file in question is about 3meg in size, the sample was a cut copy and paste of some random lines, what I am tring to do is convert and sort out one single badge number, keys pressed and location at all time of the day in question of this single badge number.Why? What do you hope to accomplish by viewing the file as letters?
vinostien
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Re: Convert a binary file to letters.
Sounds like you're going for a sort of manual approach where you scan the file with your eyes looking for every instance of the badge number. Far better would be to write a simple program that reads the file, picks out each instance of the badge number and displays the location and time. An option to print it out would be useful as well. Such a program would be no more difficult to write than what you're trying to accomplish here.what I am tring to do is convert and sort out one single badge number, keys pressed and location at all time of the day in question of this single badge number.
BERESHEIT
-
- Always Here
- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: Convert a binary file to letters.
Well, you can save the real info as a text file (comma separated values perhaps), or create a mini-database, and encrypt the file. Far more secure and far easier to manage.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: Convert a binary file to letters.
Ok, Ok, one step at a time.
Let me get the file converted first and then I will start on coding on a sort , database/breakdown or whatever.
thanks alot for the coding info.
vinostien
here is a sample of my code, I made another code that will devide the txt file into 8 numbers and a space, so each word only has 8 in it, but I can't get only one set of 8 out to convert at a time.
vinostien
Let me get the file converted first and then I will start on coding on a sort , database/breakdown or whatever.
thanks alot for the coding info.
vinostien
Code: Select all
; _ _ __ _ _ __ ___ ____ __ ___ _ _
; ( )( )( )( \( )/ \ / __)(_ _)( )( _)( \( )
; \\// )( ) (( () )\__ \ )( )( ) _) ) (
; (__) (__)(_)\_)\__/ (___/ (__) (__)(___)(_)\_)
;
; 19jun011 file test 1.2.1
File.s = OpenFileRequester("Data File", "", "Any File|*.*", 0)
If (File)
If (ReadFile(0, File))
NewFile.s = File + ".txt"
If (CreateFile(1, NewFile))
While (Not Eof(0))
number.w =ReadWord(0)
OpenConsole()
PrintN(""+Str(number))
PrintN(""+Chr(number))
Debug(numbers)
Wend
EndIf
EndIf
EndIf
vinostien
Re: Convert a binary file to letters.
this part is confusing to me, I don't know how to change the coding to let me put what is in the file in to this datasection?DataSection
Data.b 0,1,0,0,1,0,0,0; Bits 0 and 1
Data.b '0','1','0','0','1','0','0','1'; Characters '0' and '1'
EndDataSection
thanks vinostien
- Michael Vogel
- Addict
- Posts: 2797
- Joined: Thu Feb 09, 2006 11:27 pm
- Contact:
Re: Convert a binary file to letters.
Thought, you wanted to take the 8 bits (%01010101) of a character and write is as 8 bytes ("01010101") to a text file...vinostien wrote:?
Haven't checked that, but should work...
Code: Select all
File.s = OpenFileRequester("Data File", "", "Any File|*.*", 0)
If (File)
If (ReadFile(0, File))
NewFile.s = File + ".txt"
If (CreateFile(1, NewFile))
While (Not Eof(0))
number.b =ReadByte(0)
Write(1,RSet(Bin(number),8,"0")
Debug str(number) + " = "+RSet(Bin(number),8,"0")
Wend
Close(1)
EndIf
EndIf
EndIf
- Michael Vogel
- Addict
- Posts: 2797
- Joined: Thu Feb 09, 2006 11:27 pm
- Contact:
Re: Convert a binary file to letters.
You don't have to do that -- just open the file with the "binary" data and change the read command to the file number (so these code lines will look similar to the ReadFile(...) and ReadByte(...) statements in the code snippets abovevinostien wrote:this part is confusing to me, I don't know how to change the coding to let me put what is in the file in to this datasection?DataSection
Data.b 0,1,0,0,1,0,0,0; Bits 0 and 1
Data.b '0','1','0','0','1','0','0','1'; Characters '0' and '1'
EndDataSection
thanks vinostien
Re: Convert a binary file to letters.
infratec you are very right, with your help, I was able to rip appart that day in question program recording and sent the inof to the DA to be presented as evidence in court.
your help and the help from the rest was importent to me and my quest to get that info from a backup file.
vinostien "two thumbs up for all the help"
---End of Transmission---
thank you very much again, I am sorry for the unknow terms in the computer language, Like I said I am very new to computers, and don't know much about them.now it is clear. You want something like this:
your help and the help from the rest was importent to me and my quest to get that info from a backup file.
vinostien "two thumbs up for all the help"

---End of Transmission---