Guest User

Untitled

a guest
Nov 23rd, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <sys/ioctl.h>
  3. #include <stdlib.h>
  4.  
  5. int main(int argc, char *argv [])
  6. {
  7. struct winsize w;
  8. ioctl(0, TIOCGWINSZ, &w);
  9. int COLS = (w.ws_col > 0 ? w.ws_col : 80);
  10. int lines = 1;
  11. if (argc > 1) {
  12. lines = atoi(argv[1]);
  13. }
  14.  
  15. char outchar[COLS];
  16. for (int i = 0; i < COLS; i++) {
  17. outchar[i] = '#';
  18. }
  19.  
  20. for (int x = 1; x <= lines; x++) {
  21. printf("%s\n", outchar);
  22. }
  23.  
  24. return 0;
  25. }
Add Comment
Please, Sign In to add comment