This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
As an alternative to select(), for the specific case of a serial port (terminal) you can use tcsetattr() to put the file descriptor into non-canonical mode, with a read timeout. | |
To do this, unset the ICANON flag, and set the VTIME control character: | |
struct termios termios; | |
tcgetattr(filedesc, &termios); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo add-apt-repository ppa:webupd8team/atom | |
sudo apt-get update | |
sudo apt-get install atom |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Declare a variable named 'input_string' to hold our input. | |
char input_string[105]; | |
// Read a full line of input from stdin and save it to our variable, input_string. | |
scanf("%[^\n]", input_string); | |
[^\n] causes us to read till a \n is encountered. | |
If you want to read 4 characters at most, or till a newline is encountered, | |
scanf("%4[^\n]", input_string); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git checkout better_branch | |
git merge --strategy=ours master # keep the content of this branch, but record a merge | |
git checkout master | |
git merge better_branch # fast-forward master up to the merge | |
Finally, the better_branch becomes your master. |