Hi, all
I try this code, but can not compile and debug
when i compile, console such asCode:#include <stdio.h>
main()
{
FILE *fp;
char line[130];
fp = popen("netstat -n", "r");
while ( fgets( line, sizeof line, fp))
{
printf("%s", line);
}
pclose(fp);
}
Compiling...
OCMStart.c
D:\OCMStart\OCMStart.c(8) : warning C4013: 'popen' undefined; assuming extern returning int
D:\OCMStart\OCMStart.c(8) : warning C4047: '=' : 'struct _iobuf *' differs in levels of indirection from 'int '
D:\OCMStart\OCMStart.c(14) : warning C4013: 'pclose' undefined; assuming extern returning int
OCMStart.obj - 0 error(s), 3 warning(s)
When i debug, console such as
Linking...
OCMStart.obj : error LNK2001: unresolved external symbol _pclose
OCMStart.obj : error LNK2001: unresolved external symbol _popen
Debug/OCMStart.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.
OCMStart.exe - 3 error(s), 0 warning(s)
please help me to run this code
many thanks