Building my own text editor following antirez's guide.
- Setup
- Entering raw mode
- Raw input and output
- A text viewer
- A text editor
- Search
- Syntax highlighting
int tcgetattr(int fd, struct termios *termios_p);
- Retrieves the terminal configuration and stores it in a struct termios.
- fd → File descriptor of the terminal (usually STDIN_FILENO, which is 0). • termios_p → Pointer to a struct termios that stores the settings.
- Return Value:
- Success •
- -1 → Error (sets errno)
A global variable in C that stores an error code when a system call or library function fails.
- STDIN_FILENO (0) → Standard input
- STDOUT_FILENO (1) → Standard output
- STDERR (2) → Standard error
Prints an error message describing the last errno value.
perror("Error message”);
“Error message” is the prefix here.