Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

Hi eveyone.

I would like to read a binary file: Windows Address Book.

However, since I JUST want to import email addresses from WAB to my application I think I can open and read it myself.

If you see my snapshot, email addresses are human readable and just with spaces, not encoded!

So I think this command will open file file well:

Dim ReadText As Byte() = System.IO.File.ReadAllBytes("C:\Documents and Settings\Username\Application Data\Microsoft\Address Book\Username.wab")

The only problem is that I never tried to read binary files.

And don't know how to process this Byte variable: ReadText!

Do you have any idea how can I just extract email addresses?

I even have regex code to do it, but don't know how to process ReadText?

Please help me :(

Edited by SIMIN
Posted

I believe that what you are looking for is this:

 

Dim str as String = System.Text.Encoding.ASCII.GetString(ReadText)

 

However, as PD states, you'll need to know the file structure to ensure that your application does not get tricked by "non-standard" data in the file.

~Nate�

___________________________________________

Please use the [vb]/[cs] tags on posted code.

Please post solutions you find somewhere else.

Follow me on Twitter here.

Posted

Yeh, that's a slippery slope. I would definitely not try to parse a binary file with regex's. If a field changes the regex may not work. Also, your assumption is that the current file format is the full specification, which it may not be. There may be fields missing because it is the 1st of the month or some weird rule like that.

 

Is there a MS spec or api to read this file?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...