Created
September 25, 2012 22:57
-
-
Save rdp/3784971 to your computer and use it in GitHub Desktop.
C/java seem to run it reliably
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
void main(char **argv) { | |
int a = 0; | |
for(a = 0; a < 100; a++) { | |
FILE *lsofFile_p = popen("temp\\ffmpeg.exe -list_devices true -f dshow -i dummy 2>&1", "r"); | |
if (!lsofFile_p) | |
{ | |
printf("bad p"); | |
return -1; | |
} | |
int b; | |
for(b = 0; b < 20; b++) { | |
char buffer[1024]; | |
char *line_p = fgets(buffer, sizeof(buffer), lsofFile_p); | |
printf("got %s", buffer); | |
} | |
pclose(lsofFile_p); | |
printf("done file\n\n\n"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// also appears to run fine | |
class test { | |
public static void main(String... args) throws Exception { | |
Process process = Runtime.getRuntime().exec("temp\\ffmpeg.exe -list_devices true -f dshow -i dummy"); | |
byte[] bytes = new byte[4000]; | |
process.getErrorStream().read(bytes); | |
System.out.println("hellostderr" + new String(bytes)); | |
bytes = new byte[2000]; | |
process.getInputStream().read(bytes); | |
System.out.println("hellostdout" + new String(bytes)); | |
process.getErrorStream().read(bytes); | |
System.out.println("hellostderr2" + new String(bytes)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment