Source language: Translate to:

FileToVar or FileRead/all: what's the best?

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

FileToVar or FileRead/all: what's the best?

Postby Dorjee » Fri Sep 10, 2010 1:27 pm

The entire content of a file can be put in a variable according with two method: FileToVar or FileRead/all. Examples:

Code: Select all
FileToVar "[PubDir]MyFile.txt" "[MyVariable]"

FileRead "[PubDir]MyFile.txt" "All" "[MyVariable]"


Is one method best than the other and which?

Or has each method any specification (eg. the size of the file or something else...)?
Dorjee the Neobooker
Dorjee
 
Posts: 27
Joined: Thu Nov 17, 2005 12:15 am

Postby Gaev » Fri Sep 10, 2010 2:02 pm

Dorjee:

From the Help file for FileToVar ...
Purpose:
Read the contents of a file into a variable. This is similar to using FileRead with the “All” option, but unlike FileRead, FileToVar can be used with Embedded files.
User avatar
Gaev
 
Posts: 3735
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Great

Postby Dorjee » Fri Sep 10, 2010 2:34 pm

Great, thank you. Always read carefully the help file :lol:
Dorjee the Neobooker
Dorjee
 
Posts: 27
Joined: Thu Nov 17, 2005 12:15 am

Precisions

Postby Dorjee » Sat Sep 11, 2010 12:33 am

I ask this question because a plugin creator told me that:

It (FileToVar) is a WRONG function. There is a limit to the
variable length supported by NeoBook. In addition, it may read the
extended chars wrongly.


Are these statements right?
Dorjee the Neobooker
Dorjee
 
Posts: 27
Joined: Thu Nov 17, 2005 12:15 am

Postby Neosoft Support » Mon Sep 13, 2010 10:25 am

It (FileToVar) is a WRONG function. There is a limit to the
variable length supported by NeoBook. In addition, it may read the
extended chars wrongly.


The maximum size of a variable in NeoBook depends on the version of Windows you're using. With Windows XP and higher the maximum variable size is about 4GB.

I'm not sure what he means about the extended characters not being read correctly. As long as the files are standard Ansi/Ascii text format NeoBook should read them correctly.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5603
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA


Return to NeoBook Action Commands

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

cron