-1

I hope that this is not a stupid question. Is it possible to redirect stdin to a FILE?

FILE* somePipe = _popen("SOME_FILE", "r");

Can I assign somePipe to stdin?

Appleman1234
  • 15,946
  • 45
  • 67
Jean-Luc
  • 3,563
  • 8
  • 40
  • 78

2 Answers2

1

Try using freopen():

 FILE* somePipe = freopen("SOME_FILE", "r", stdin);
Cyclonecode
  • 29,115
  • 11
  • 72
  • 93
0
 FILE* inPipe   freopen("newstdin", "r", stdin);
 FILE* outPipe  freopen("newstdout", "w", stdout);
Rohit Vipin Mathews
  • 11,629
  • 15
  • 57
  • 112