I want to write a program which returns the string you write. But it always prints it without the first character. Also, it doesn't return anything past the first space.
Example:
IN: test
OUT: est
Code:
extern printf, scanf, exit
global main
section .text
main:
push rbp
;input of string
mov rdi, format
mov rsi, string
mov rax, 0
call scanf
;output of string
mov rdi, format_out
mov rsi, qword [string]
mov rax, 0
call printf
_exit: ;end of program
pop rbp
call exit
section .data
format db "%s", 0
string db 0
format_out db "You wrote: %s", 0
I noticed that if I change string db 0
to string db
", it shows an error, but the program works correctly, printing the entire sentence to the first space. Unfortunately I don't have any clue what to do with that info. Thanks for the answer.