mIRC Home    About    Download    Register    News    Help

Print Thread
#95591 25/08/04 09:15 PM
Joined: Feb 2004
Posts: 714
Z
Hoopy frood
OP Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
Since I started working with hash tables, which was not long ago, I have only saved them in .txt files. In other scripts, however, I've seen them with different file types. Here's my question... it might be dumb, but there's nothing about it on the help file: What are the file types supported by a Hash table? And more important than that: What is the best file to use?

Zyzzyx smile


"All we are saying is give peace a chance" -- John Lennon
#95592 25/08/04 09:18 PM
Joined: Mar 2004
Posts: 540
A
Fjord artisan
Offline
Fjord artisan
A
Joined: Mar 2004
Posts: 540
Quote:
/hsave -sbnioau <name> <filename> [section]
Load or save a table to/from a file.

These load/save plain text to a text file, with item and data on separate lines. $cr and $lf characters are stripped from text when saving as plain text.

The -b switch loads or saves binary files. $cr and $lf are preserved when saving as binary files.


Read the last one

#95593 25/08/04 09:21 PM
Joined: Feb 2004
Posts: 714
Z
Hoopy frood
OP Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
That part only talks about text files. I also know that they can be saved on .ini files too, but I've seen ppl saving them in other kinds of files (=no extension that I'm familiar with), so I'm asking about those other extensions.


"All we are saying is give peace a chance" -- John Lennon
#95594 25/08/04 09:23 PM
Joined: Mar 2004
Posts: 540
A
Fjord artisan
Offline
Fjord artisan
A
Joined: Mar 2004
Posts: 540
You can save as a binary file that is not just plain text

#95595 25/08/04 09:42 PM
Joined: Feb 2004
Posts: 714
Z
Hoopy frood
OP Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
When I say saving the file I mean like this: /hsave -o Test filename.txt

I've never worked with binary files, so I don't really know what you mean. Do they need an extension or just "filename" will do?

Zyzzyx


"All we are saying is give peace a chance" -- John Lennon
#95596 25/08/04 10:22 PM
Joined: Aug 2004
Posts: 101
D
Vogon poet
Offline
Vogon poet
D
Joined: Aug 2004
Posts: 101
File extensions don't really matter! It's the format that counts! You can name a text file something.ini, something.doc, even something.jpg! It'll still be a text file and to read it properly you need a simple text editor!

Edit: Of course file extensions are used to separate file types, but this doesn't have to do with the way data is being stored! In general you can use any extension for a file! Perhaps if you give an extension example of the ones you don't understand we could explain it to you!

There are three formats you can save a hash table into:
-simple text file (readable by Notepad)
-ini file (text files with the common ini format)
-binary file

In text files everything is stored with its ASCII value.
In binary files everything is stored with its binary value.
This actually affects only numbers. For large amount of data it makes the file much much smaller (and that's the point after all)! The other basic difference is that binary files are not readable by a text editor (again as far as numbers are concerned).

eg. number 22 is 0001 0110 binary while it is 0011 0010 0011 0010 ( 50 50) ascii (in text) - already saved a byte!

and that's it more or less...

Last edited by dr_Eamer; 25/08/04 10:27 PM.

Maybe I wake up one day to notice that all my life was just a dream!
#95597 25/08/04 10:47 PM
Joined: Feb 2004
Posts: 714
Z
Hoopy frood
OP Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
Oh, I see now.. One last question: when you say to save it as binary, I have to use the -b switch, right? How about the filename? Does it have any special extension?

Zyzzyx smile


"All we are saying is give peace a chance" -- John Lennon
#95598 25/08/04 10:55 PM
Joined: Aug 2004
Posts: 101
D
Vogon poet
Offline
Vogon poet
D
Joined: Aug 2004
Posts: 101
That's what I meant to say! No there is no particular extension! I personally usually prefer .dat (for data). You can use .hsh (for hash) or something resembling your script's name or even no extension at all! Just don't use a common extension like .jpg or .doc or .xls that will likely associate your file with a program... Use something simple or grab an idea from other scripts...

Edit: I completely forgot! The extension .bin is used to denote binary files! You can still choose another one tho...

Last edited by dr_Eamer; 25/08/04 10:58 PM.

Maybe I wake up one day to notice that all my life was just a dream!
#95599 25/08/04 11:04 PM
Joined: Feb 2004
Posts: 714
Z
Hoopy frood
OP Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
Oh, gotcha now smile Thanks!


"All we are saying is give peace a chance" -- John Lennon

Link Copied to Clipboard