***************************************************************************
StreamWriter stWriter = new StreamWriter("c:traces",false);
listener t = new TextWriterTraceListener(stWriter);
Please, how i can set the size of the file. For example, if i want a file
of 100 ko maximum.
Thanks
09-13-2002, 08:57 PM
PWilmarth
Re: files
Here are the methods and properties of a File Stream.
public class System.IO.FileStream :
System.IO.Stream,
IDisposable
{
// Fields
// Constructors
public FileStream(IntPtr handle, System.IO.FileAccess access);
public FileStream(IntPtr handle, System.IO.FileAccess access, bool ownsHandle);
public FileStream(IntPtr handle, System.IO.FileAccess access, bool ownsHandle,
int bufferSize);
public FileStream(IntPtr handle, System.IO.FileAccess access, bool ownsHandle,
int bufferSize, bool isAsync);
public FileStream(string path, System.IO.FileMode mode);
public FileStream(string path, System.IO.FileMode mode, System.IO.FileAccess
access);
public FileStream(string path, System.IO.FileMode mode, System.IO.FileAccess
access, System.IO.FileShare share);
public FileStream(string path, System.IO.FileMode mode, System.IO.FileAccess
access, System.IO.FileShare share, int bufferSize);
public FileStream(string path, System.IO.FileMode mode, System.IO.FileAccess
access, System.IO.FileShare share, int bufferSize, bool useAsync);
// Properties
public bool CanRead { virtual get; }
public bool CanSeek { virtual get; }
public bool CanWrite { virtual get; }
public IntPtr Handle { virtual get; }
public bool IsAsync { virtual get; }
public long Length { virtual get; }
public string Name { get; }
public long Position { virtual get; virtual set; }
// Methods
public virtual IAsyncResult BeginRead(byte[] array, int offset, int numBytes,
AsyncCallback userCallback, object stateObject);
public virtual IAsyncResult BeginWrite(byte[] array, int offset, int
numBytes, AsyncCallback userCallback, object stateObject);
public virtual void Close();
public virtual System.Runtime.Remoting.ObjRef CreateObjRef(Type requestedType);
public virtual int EndRead(IAsyncResult asyncResult);
public virtual void EndWrite(IAsyncResult asyncResult);
public virtual bool Equals(object obj);
public virtual void Flush();
public virtual int GetHashCode();
public virtual object GetLifetimeService();
public Type GetType();
public virtual object InitializeLifetimeService();
public virtual void Lock(long position, long length);
public virtual int Read(byte[] array, int offset, int count);
public virtual int ReadByte();
public virtual long Seek(long offset, System.IO.SeekOrigin origin);
public virtual void SetLength(long value);
public virtual string ToString();
public virtual void Unlock(long position, long length);
public virtual void Write(byte[] array, int offset, int count);
public virtual void WriteByte(byte value);
So you could use the SetLength method to set the length of your file.