Created
January 26, 2015 07:25
-
-
Save pjc0247/cadcbe61c7f2130cd226 to your computer and use it in GitHub Desktop.
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 <io.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string> | |
int main(int argc, char* argv[]){ | |
FILE *fp = _popen("dir", "r"); | |
std::string buffer; | |
while(true){ | |
char b[256] = {0}; | |
fread(b, _countof(b)-1, 1, fp); | |
buffer.append(b); | |
if(feof(fp)) break; | |
} | |
printf("%s", buffer.c_str()); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment