diff options
Diffstat (limited to 'core/os/file_access.cpp')
-rw-r--r-- | core/os/file_access.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/core/os/file_access.cpp b/core/os/file_access.cpp index 23250a7345..31e7d19bae 100644 --- a/core/os/file_access.cpp +++ b/core/os/file_access.cpp @@ -428,8 +428,30 @@ void FileAccess::store_string(const String& p_string) { CharString cs=p_string.utf8(); store_buffer((uint8_t*)&cs[0],cs.length()); - } + +void FileAccess::store_pascal_string(const String& p_string) { + + CharString cs = p_string.utf8(); + store_32(cs.length()); + store_buffer((uint8_t*)&cs[0], cs.length()); +}; + +String FileAccess::get_pascal_string() { + + uint32_t sl = get_32(); + CharString cs; + cs.resize(sl+1); + get_buffer((uint8_t*)cs.ptr(),sl); + cs[sl]=0; + + String ret; + ret.parse_utf8(cs.ptr()); + + return ret; +}; + + void FileAccess::store_line(const String& p_line) { store_string(p_line); |