I need to add new line to a text file. File is opened as text file (not binary) because I need to put some symbols there too. What opcode (or several opcodes) should I use?
add new line to text file
Posted 05 May 2014 - 02:13 AM Edited by Ashwin the new boy, 05 May 2014 - 02:14 AM.
Write "0D 0A" these two bytes to the File,in order to start from a new Line,
Posted 05 May 2014 - 12:23 PM Edited by Silent, 05 May 2014 - 07:12 PM.
0ACE: print_help_formatted "Line #1%cLine #2" 0xAThe %c specifier in format strings will read the value of any number and display it as the relevant ASCII character. 0xA is the '\n' newline character.
This should print 2 lines of help text. Similarly, if you want to output a new line to a file:
0AD9: write_formatted_string_to_file 0@ format "My File...%c" 0xAHowever, this will only work if you've opened the file in text mode, as the 0xA will actually be translated to 0x0D0A, as that is the proper way to end lines in files on Windows. If you were to open it in plain binary mode, you'd have to write that yourself:
0AD9: write_formatted_string_to_file 0@ format "My File...%c" 0x0D0AEDIT:
As all CLEO commands commonly just bridge functions from C libraries, here is the reference for fopen - with links to similar file IO functions you may find in CLEO (fread/fwrite/etc.):
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users