Pixel-Composer/scripts/text_file/text_file.gml

25 lines
551 B
Plaintext
Raw Normal View History

2023-02-28 09:43:01 +01:00
function file_text_read_all(path) {
var f = file_text_open_read(path);
2023-01-01 02:06:02 +01:00
var s = "";
2023-02-28 09:43:01 +01:00
while(!file_text_eof(f))
2023-03-22 06:59:58 +01:00
s += string(file_text_readln(f));
2023-02-28 09:43:01 +01:00
file_text_close(f);
2023-01-01 02:06:02 +01:00
return s;
}
2023-02-28 09:43:01 +01:00
function file_text_read_all_lines(path) {
var f = file_text_open_read(path);
2023-01-04 02:30:04 +01:00
var s = [];
2023-03-22 07:07:38 +01:00
while(!file_text_eof(f))
2023-02-28 09:43:01 +01:00
array_push(s, file_text_readln(f));
file_text_close(f);
2023-01-04 02:30:04 +01:00
return s;
}
2023-02-28 09:43:01 +01:00
function file_text_write_all(path, str) {
2023-10-18 14:58:55 +02:00
if(file_exists(path)) file_delete(path);
2023-02-28 09:43:01 +01:00
var f = file_text_open_write(path);
2023-01-01 02:06:02 +01:00
file_text_write_string(f, str);
file_text_close(f);
}