TurboC again

John Allen on wsl john at wsl.UUCP
Tue Feb 6 14:02:09 AEST 1990


In article <UZl651y00WB8IWjHtL at andrew.cmu.edu> bg0l+ at andrew.cmu.edu (Bruce E. Golightly) writes:
>
>The statement:
>
>    system("sort <c:\\directory\\filename.ext >c:\\directory\\filename.ext");
>
>from this state, the system hangs up badly. Suggestions?
>

try this
/* connect stdin & stdout to the files you want to process */
freopen("c:/directory/filename.ext", "r", stdin);
freopen("c:/directory/filename.ext", "w", stdout);
/* spawn the program */
spawnlp(P_WAIT, "sort", "sort", NULL);
/* connect stdin & stdout back to the console */
freopen("con", "r", stdin);
freopen("con", "w", stdout);

-- 
People that don't know want to know from the people that do know and if the 
poeple that do know don't tell the people that don't know then the people
that don't know still won't know.
				   "Don't quote me on any issue whatsoever."



More information about the Comp.lang.c mailing list