experiments

All kinds of coding experiments
Log | Files | Refs | Submodules

ncwt.c (501B)


      1 #include <ncurses.h>
      2 #include <unistd.h>
      3 // ncurses and getcwd. Baaaasics of a filemanager
      4 
      5 int main(){
      6     initscr();
      7     raw();
      8 
      9 
     10     char cwd[1024];
     11     if(getcwd(cwd, sizeof(cwd)) != NULL)
     12         printw("%s\n", cwd);
     13     else{
     14         printw("Working dir not found");
     15         return 0;
     16     }
     17     
     18     char nuch; 
     19     int pos = 0;
     20     while(nuch != '0'){
     21         nuch = getch();
     22         move(0,pos);
     23         addch(nuch);
     24         pos++;
     25     }
     26     
     27     endwin();                   
     28 
     29     return 0;
     30 }