File I/O & Text Manipulation
Last modified: 24 May 2026
What is this?
A suite of native keywords designed exclusively for reading, writing, and editing files directly from the disk. While standard C++ requires developers to manually manage file streams, buffers, and string iterations, ArkCode achieves these actions securely in single-line operations.
What is its purpose?
File handling in standard languages is incredibly verbose. ArkCode's purpose here is to condense reading, writing, and even line-splicing into single-line atomic operations, allowing you to manipulate disk data effortlessly.
Where and how it can be used
Use it to build automated scripts, generate configurations, or modify text databases. You can instantly dump file contents into memory, stream specific lines, slice exact line ranges using replacefiletext, or use standard functions to read/write entire files.
// Write a full file to disk using standard library helper
fswrite("output.txt", "Full text file content here")
// Read a full file as a string
value content = fsread("output.txt")
// Extract a precise line using the custom linefrom primitive
value target = linefrom("output.txt" = "1")How it works
ArkCode provides two layers of file IO: high-level standard library functions (fsread and fswrite) that operate using standard function calls to read and write entire files synchronously, and specialized interpreter primitives (like linefrom and replacefiletext) that parse custom syntax using = and ; separators to read or slice-replace files efficiently line by line.
Where it can't be used and why
You cannot use file operations like replacefiletext to mutate raw binary files (like PNG images or executables). Because the logic utilizes line-break tokenization, attempting to slice binary arrays will result in file corruption. Furthermore, the editfile function only renames OS file references; it does not transcode formats (e.g., converting a JPG to a WebP is not possible natively).