What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [Help] What is the best way to read binary file ??

[Help] What is the best way to read binary file ??
Author: Message:
N0na
New Member
*

Avatar
~ Nicks Plus Support ~

Posts: 4
34 / Female / –
Joined: Apr 2009
O.P. Huh?  [Help] What is the best way to read binary file ??
hey again :$



sorry for the new thread , but i've searched alot and didn't find what i want =)

im wondering about the best way to read/write binary files ,

i want that for saving and reading sittings in an own crypting method , so user can't edit or play with the sittings file.

i thought about ReadFile API and FSO , but i think ReadFile supports binary and FSO don't , because FSO functions called "OpenAsTextStream" and that isn't a normal text file =\

so , if there is any piece of code of reading a files into DataBloc object , we Appreciate that .8-|


sorry if the answer exist before , but i couldn't get it ,


thanks in advanced ...(Y)
04-18-2009 09:14 AM
Profile E-Mail PM Web Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: [Help] What is the best way to read binary file ??
Eljay's reply to unicode problem
04-18-2009 01:06 PM
Profile E-Mail PM Find Quote Report
N0na
New Member
*

Avatar
~ Nicks Plus Support ~

Posts: 4
34 / Female / –
Joined: Apr 2009
O.P. RE: [Help] What is the best way to read binary file ??
[thanks] for ur post :)


i'l check wht i can do with it , sorry i didn't search alot , but there must be a thread for "Files reading/writing" and for registry , and so :)

have a nice day
sorry ,

i used the code posted , but the file size gives me the file till the 1st null char

because variables are null terminated or something like that =|


is there any other way to do what i want wich is reading binary file into datablock ?

have a nice day.
04-18-2009 02:00 PM
Profile E-Mail PM Web Find Quote Report
MeEtc
Patchou's look-alike
*****

Avatar
In the Shadow Gallery once again

Posts: 2200
Reputation: 60
38 / Male / Flag
Joined: Nov 2004
Status: Away
RE: [Help] What is the best way to read binary file ??
I have a helper script written by Volv that works with binary data. I'll post/attach when I get home.

These should help.

JScript code:
function binReadFile(filePath)
{
    var fstream = new ActiveXObject("ADODB.Stream");
    fstream.Type = 1;
    fstream.Open;
    fstream.LoadFromFile(filePath);
    return fstream.Read;
}

function binWriteFile(binData, filePath)
{
    var fstream = new ActiveXObject("ADODB.Stream");
    fstream.Type = 1;
    fstream.Open;
    fstream.Write(binData);
    fstream.SaveToFile(filePath, 2);
    fstream.Close;
}

function asciiReadFile(filePath)
{
    var fso = new ActiveXObject("Scripting.FileSystemObject");
    var contents = fso.OpenTextFile(filePath, 1, 0).ReadAll();
    return contents;
}

function asciiWriteFile(strData, filePath)
{
    var fso = new ActiveXObject("Scripting.FileSystemObject");
    var txtfile = fso.CreateTextFile(filePath, true);
    txtfile.Write(strData);
    txtfile.close();
}

function GetFileSize(filePath)
{
    var fso = new ActiveXObject("Scripting.FileSystemObject");
    if(fso.FileExists(filePath)) {
        var file = fso.getFile(filePath);
        return file.size;
    } else {
        return -1;
    }
}


This post was edited on 04-19-2009 at 03:32 AM by MeEtc.
[Image: signature/]     [Image: sharing.png]
I cannot hear you. There is a banana in my ear.
04-19-2009 01:41 AM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On