⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 l-out.c

📁 The pipe "|" char in linux rewrite in C. Another example of managing streams in C.
💻 C
字号:
/*l-out.c simple pipe .c , you can ripper it if you need.  compile with gcc l-out.c -o l-out  usage :  bash-2.05a$ ./ciao "nmap localhost" lupo  bash-2.05a$ cat lupo  Starting nmap V. 3.00 ( www.insecure.org/nmap/ )  Interesting ports on localhost (127.0.0.1):  (The 1595 ports scanned but not shown below are in state: closed)  Port       State       Service  21/tcp     open        ftp                       23/tcp     open        telnet                    25/tcp     open        smtp                      587/tcp    open        submission                6000/tcp   open        X11                       6699/tcp   open        napster                    Nmap run completed -- 1 IP address (1 host up) scanned in 1 second  bash-2.05a$*/ #include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>void usage(){ fprintf (stdout,"l-out.c [command] [filelog]\n"); exit(0);}int main( int argc, char** argv ){ FILE* f; FILE* record; char *recordstring; char *command;     if (argc<3) usage();    command=argv[1];     if ( ( record = fopen(argv[2],"wb")) == NULL ) 	{      	perror("fopen" );      	exit (0);    	}	    if( ( f = popen( buffer, "r" ) ) == NULL ) 	{    	perror( "popen" );    	return EXIT_FAILURE;    	}    while(!feof(f))    	{    	recordstring=malloc(sizeof(recordstring));    	fgets(recordstring,sizeof(recordstring),f);    	fprintf (record,"%s",recordstring);    	}    fclose(record);    pclose( f );    return EXIT_SUCCESS; }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -