c - Replacing stdin within a piece of code -
i have piece of code uses stdin. when run program command-line pass location of wav file i.e. /users/username/desktop/music.wav.
the code written in c. stdin variable runs throughout 2 functions.
how replace stdin within code input of file directory , location?
in other words, how hard code '/users/username/desktop/music.wav' 2 different c functions.
i think looking freopen.
if understand correctly, read filename argv[1]
, call freopen():
freopen(argv[1], "r", stdin);
Comments
Post a Comment