Sure, anything is possible:
Code:
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
int main()
{
int c;
FILE *str_fp;
char *str = "your string data";
char *buff = malloc(strlen(str) +8);
sprintf(buff, "echo '%s'", str);
str_fp = popen(buff, "r");
while((c = fgetc(str_fp)) != EOF)
{
putchar(c);
}
pclose(str_fp);
free(buff);
}
It has limitations -- you can't have (unescaped) single quote characters or null bytes in the string. It's more a fun toy than a real method.
Personally, I'd rewrite your code to abstract out the I/O. Then you could just drop in different methods.