writer class : writer(string,bool,bool) fitter

Description

Gets a new instance of writer class which is initialized with the file path, writing mode, and specifying the presence of the byte order mark(BOM).

Syntax

new writer(string fullPath, bool append, bool bom)

Arguments

ClassNameDescription
stringfullPathThe complete file path.
boolappendA value that indicates the writing mode.
boolbomA value that indicates the presence of the byte order mark(BOM).

Return value

ClassDescription
writerA new instance of writer class that is initialized by specified value.

Sample code

1:

writer w = new writer("c:\somewhere...\sample.txt", true, true);

Notes

It's a wrapper of the System.IO.StreamWriter.StreamWriter(String,Boolean,Encoding) constructor.

This fitter creates a instance of Writer class with UTF-8 encoding.

If sets the true to the second argument, the instance of writer class is initialized as append mode. Otherwise, it is initialized as overwrite mode.

If sets the true to the third argument, the byte order mark(BOM) will be writen to the file. Otherwise, the byte order mark(BOM) will not be writen to the file.

Links for reference

Copyright © Cooker All rights reserved.