The code mostly works. It seems that ~/a.txt is not interpreted correctly, but if I use the full path then it finds the file. Also, #[cfg(target_os = "unix")] is accepted for QNX (again, I don't know why), but if I remove it I get the expected print of 4096.