Page 2 of 2

Re: Convert a binary file to letters.

Posted: Mon Jun 13, 2011 2:30 pm
by Michael Vogel
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.

Posted: Tue Jun 14, 2011 12:52 am
by vinostien
Hi, thanks alot, that seams to be what I am looking for in a code, thanks again.
Why? What do you hope to accomplish by viewing the file as letters?
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.

vinostien

Re: Convert a binary file to letters.

Posted: Tue Jun 14, 2011 1:38 am
by netmaestro
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.
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.

Re: Convert a binary file to letters.

Posted: Tue Jun 14, 2011 3:11 pm
by IdeasVacuum
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.

Re: Convert a binary file to letters.

Posted: Thu Jun 16, 2011 12:57 am
by vinostien
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

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
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

Re: Convert a binary file to letters.

Posted: Thu Jun 23, 2011 1:23 am
by vinostien
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
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?

thanks vinostien

Re: Convert a binary file to letters.

Posted: Fri Jun 24, 2011 12:51 pm
by Michael Vogel
vinostien wrote:?
Thought, you wanted to take the 8 bits (%01010101) of a character and write is as 8 bytes ("01010101") to a text file...

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

Re: Convert a binary file to letters.

Posted: Fri Jun 24, 2011 12:56 pm
by Michael Vogel
vinostien wrote:
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
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?

thanks vinostien
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 above

Re: Convert a binary file to letters.

Posted: Sun Jun 26, 2011 7:50 pm
by vinostien
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.
now it is clear. You want something like this:
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.
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" :D

---End of Transmission---