G
George
Hi All,
In trying to learn streams I'd like to rewrite this from the popen man
page:
#include <stdio.h>
#include <stdlib.h>
main( )
{
char *cmd = "/usr/bin/ls *.c";
char buf[BUFSIZ];
FILE *ptr;
if ((ptr = popen(cmd, "r")) != NULL)
while (fgets(buf, BUFSIZ, ptr) != NULL)
(void) printf("%s", buf);
(void) pclose(ptr);
return 0;
}
I was going to try to use istream_iterator and std::copy. Is it
possible to get the FILE* into an ifstream object?
Thanks much for my stupid question. Sincerely, G
In trying to learn streams I'd like to rewrite this from the popen man
page:
#include <stdio.h>
#include <stdlib.h>
main( )
{
char *cmd = "/usr/bin/ls *.c";
char buf[BUFSIZ];
FILE *ptr;
if ((ptr = popen(cmd, "r")) != NULL)
while (fgets(buf, BUFSIZ, ptr) != NULL)
(void) printf("%s", buf);
(void) pclose(ptr);
return 0;
}
I was going to try to use istream_iterator and std::copy. Is it
possible to get the FILE* into an ifstream object?
Thanks much for my stupid question. Sincerely, G