Mega Code Archive

 
Categories / C / Beginners
 

Show the active computers in the lan

#include<stdio.h> #include<conio.h> #include<dos.h> #include<string.h> #include<graphics.h> #include<stdlib.h> //#include"h:incmenu1.c" //void netview() void main() { FILE *fs; int count=0; char ch; int gd=DETECT,gm; initgraph(&gd,&gm,""); //make(); cleardevice(); closegraph(); make(); fs=fopen("temp.txt","r"); // make(); if(fs==NULL) { clearviewport(); printf("file not found"); getch(); // if(getch()==27) // menu1(); } else while(1) { ch=fgetc(fs); if(ch==EOF) break; if(ch==' ') count++; if(count==24) { count=0; //getch(); printf(" Press Enter"); getch(); clearviewport(); setbkcolor(1); } setbkcolor(1); ch= fputc(fs,fs); printf("%c",ch); } // if(getch()==27) // menu1(); fs=fopen("temp1.txt","r"); if(fs==NULL) { printf("file not found"); getch(); // if(getch()==27) // menu1(); } else while(1) { ch=fgetc(fs); if(ch==EOF) break; printf("%c",ch); } putc(ch,fs); fclose(fs); getch(); // menu1(); } make() { system("net view > temp.txt"); system("net user > temp1.txt"); return 1; }