Redirect STDOUT to file

This commit is contained in:
cabelo 2019-03-25 12:05:18 -03:00 committed by Stefan Haustein
parent f055e5b675
commit 5ef1f70a3a
2 changed files with 11 additions and 0 deletions

View file

@ -65,3 +65,9 @@ If multiple images match the filename spec, thumbnails are shown.
The top image was generated with the character optimization disabled via the `-0` option.
![Comparison](https://i.imgur.com/OzdCeh6.png)
## Redirect to file
Bellow the example for redirect stdout to one file.
![Redirect](https://i.imgur.com/8UyGjg8.png)

View file

@ -443,6 +443,11 @@ int main(int argc, char* argv[]) {
struct winsize w;
ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
//If redirect STDOUT to one file ( col and row == 0 )
if(w.ws_col == 0 && w.ws_row == 0) {
ioctl(0, TIOCGWINSZ, &w);
}
int maxWidth = w.ws_col * 4;
int maxHeight = w.ws_row * 8;
int flags = 0;