hmmmm... a moze tak?
Kod:
ipconfig | moja_aplikacja
Wtedy aplikacja czyta z STDIN i zbiera dane... w perlu robie tak ze otwieram strumien...
Kod:
#!/usr/bin/perl
use strict;
use warnings;
print "Odczytuje dane z ipconfig... ";
open (FH, "ipconfig |") || die "Can't open ipconfig: $!\n";
my @ipconfig_lines = <FH>;
close (FH);
print "OK\n";
print @ipconfig_lines;
to zwroci (wlasnie sprawdzalem)
Kod:
Odczytuje dane z ipconfig... OK
Windows IP Configuration
Ethernet adapter Wireless Network Connection:
Connection-specific DNS Suffix . :
IP Address. . . . . . . . . . . . : x.x.x.x
Subnet Mask . . . . . . . . . . . : y.y.y.y
Default Gateway . . . . . . . . . : z.z.z.z
Ethernet adapter Local Area Connection:
Media State . . . . . . . . . . . : Media disconnected
To teraz pozostaje przelozyc to na C/C++