File Text – Giavapps File

 

File Text

 

gf_file_text_open_read(FileName) Loads a text file in the memory for reading. This function returns a FileIndex which you can use with other file_text_* functions or -1 otherwise.

FileName: a valid file name. This argument doesn’t support Unicode characters.

 

gf_file_text_read_line(FileIndex, LineIndex) Returns the specified line from the given text file.

FileIndex: a valid file index.
LineIndex: line index.

 

gf_file_text_open_write(FileName) Loads a text file in the memory for writing. This function returns a FileIndex which you can use with other file_text_* functions or -1 otherwise.

FileName: a valid file name. This argument doesn’t support Unicode characters.

 

gf_file_text_write_line(FileIndex, Line) Adds a new line for the specified file. PLEASE NOTE: data will be written only when you close the file. If the file already exists it will be replaced.

FileIndex: a valid file index.
Line: text line. This argument supports Unicode characters.

 

gf_file_text_line_count(FileIndex) Returns the total number of lines for the specified text file or -1 if fails.

FileIndex: a valid file index.

 

gf_file_text_close(FileIndex) Frees memory occupied by the resource and writes any pending buffer.

FileIndex: a valid file index.

 

Code Examples

 

Reading Text Files

 

var filename = "file.txt";
file = gf_file_text_open_read(filename);

for(var i=0; i<gf_file_text_line_count(file); i++)
{
show_message(gf_file_text_read_line(file, i));
}

gf_file_text_close(file);

 

Writing Text Files

 

var filename = "file.txt";
file = gf_file_text_open_write(filename);
gf_file_text_write_line(file, "LINE 1");
gf_file_text_write_line(file, "LINE 2");
gf_file_text_write_line(file, "LINE 3");
gf_file_text_close(file);

 

I am Luigi Piscopo, also known as DJ GiDeejay / Producer / Remixer in the music world. I am a Producer with a lot of experience in photo editing, video editing, audio editing, graphic design, web design, programming and promotion.

 

Leave a Reply

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *

*