freopen

[DllImport("msvcrt.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, SetLastError = true)]
public static extern IntPtr freopen(
   string filename,
   string mode,
   IntPtr stream
);

Microsoft documentation: Link

Last updated