{"name":"loadFile","operator":null,"title":"loadFile","type":"command","url":"https://community.bistudio.com/wiki/loadFile","revid":352208,"updated":"2024-02-01T23:26:04Z","groups":["Program Flow"],"status":"ok","replaced_by":[],"games":[{"game":"ofp","name":"Operation Flashpoint","version":"1.90"},{"game":"ofpe","name":"Operation Flashpoint: Elite","version":"1.00"},{"game":"arma1","name":"Armed Assault","version":"1.00"},{"game":"arma2","name":"Arma 2","version":"1.00"},{"game":"arma2oa","name":"Arma 2: Operation Arrowhead","version":"1.50"},{"game":"tkoh","name":"Take On Helicopters","version":"1.00"},{"game":"arma3","name":"Arma 3","version":"0.50"}],"since":{"game":"ofp","name":"Operation Flashpoint","version":"1.90"},"arma3_since":"0.50","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"description":"Returns the content of given files. If you plan to compile said string, be aware that the file should not contain comments or compile will throw an error. If there are comments, use preprocessFile/preprocessFileLineNumbers instead.\n\n> [!WARNING]\n> If the file is not prepared using UTF-8 encoding and contains some characters with codes > 127, they might convert incorrectly.","syntaxes":[{"syntax":"loadFile fileName","since":null,"effect":null,"exec":null,"params":[{"name":"fileName","type":"String","optional":false,"default":null,"description":null,"types":["String"],"since":null,"text":"fileName: String"}],"returns":{"type":"String","types":["String"],"description":null,"text":"String"},"form":"unary","operator":null,"left":null,"right":{"text":"fileName","types":["String"]}}],"examples":[{"text":"```sqf\n_contents = loadFile \"wantedString.txt\";\n```","code":["_contents = loadFile \"wantedString.txt\";"]},{"text":"```sqf\n_contents = compile loadFile \"myFunction.sqf\"; // will compile string into code\n```","code":["_contents = compile loadFile \"myFunction.sqf\"; // will compile string into code"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["fileExists","preprocessFile","preprocessFileLineNumbers"],"notes":[],"categories":[]}