// Authors:
// Jonathan Pryor (jonpryor@vt.edu)
//
-// (C) 2005 Jonathan Pryor
+// (C) 2005-2006 Jonathan Pryor
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
public StdioFileStream (string path)
{
- InitStream (Fopen (path, "r"), true);
+ InitStream (Fopen (path, "rb"), true);
}
public StdioFileStream (string path, string mode)
if (path.Length == 0)
throw new ArgumentException ("path");
if (mode == null)
- throw new ArgumentNullException ("path");
+ throw new ArgumentNullException ("mode");
IntPtr f = Native.Stdlib.fopen (path, mode);
if (f == IntPtr.Zero)
throw new DirectoryNotFoundException ("path",
canWrite = true;
Native.Stdlib.clearerr (file);
}
- catch (Exception e) {
+ catch (Exception) {
throw new ArgumentException (Locale.GetText ("Invalid file stream"), "fileStream");
}
GC.KeepAlive (this);
{
if (file == InvalidFileStream)
throw new ObjectDisposedException ("Invalid File Stream");
+ GC.KeepAlive (this);
}
public IntPtr Handle {
}
}
- [Obsolete ("Use SaveFilePosition (Mono.Unix.Native.FilePosition)", true)]
- public void SaveFilePosition (FilePosition pos)
- {
- AssertNotDisposed ();
- int r = Stdlib.fgetpos (file, pos);
- UnixMarshal.ThrowExceptionForLastErrorIf (r);
- GC.KeepAlive (this);
- }
-
public void SaveFilePosition (Native.FilePosition pos)
{
AssertNotDisposed ();
GC.KeepAlive (this);
}
- [Obsolete ("Use RestoreFilePosition (Mono.Unix.Native.FilePosition)", true)]
- public void RestoreFilePosition (FilePosition pos)
- {
- AssertNotDisposed ();
- if (pos == null)
- throw new ArgumentNullException ("value");
- int r = Stdlib.fsetpos (file, pos);
- UnixMarshal.ThrowExceptionForLastErrorIf (r);
- GC.KeepAlive (this);
- }
-
public void RestoreFilePosition (Native.FilePosition pos)
{
AssertNotDisposed ();