Now do a WiFi API-related library, so that other people can manage WiFi.
When invoking the API, reply to shell-printed information, such as search hotspots, and do not print in the shell. The information is then returned to the program that invokes the API.
#include <stdio.h>#include <stdlib.h>IntMain( Intargc, Char *Argv[] ){ FILE *Fp; CharPath[1035]; /* Open the command for reading. */Fp=Popen("/bin/ls/etc/", "R"); If (Fp==Null) {Printf("Failed to run command\n" );Exit(1); } /* Read the output a line at a time-output it. */ While (Fgets(Path, sizeof(Path), FP)! = NULL) { printf("%s", path); } /* Close */pclose (fp); return 0; }
You want the "Popen" function. Here's an example of running, the command "Ls/etc" and outputing to the console.
C:run a System Command and Get Output? The tool is called in a C program and results are obtained.