Read the actual contents of text file using FileStream and these options c#

Maybe something like:

    FileStream fileStream = new FileStream("[path]", FileMode.Open, FileAccess.Read, FileShare.Read, 64 * 1024,
        (FileOptions)0x20000000 | FileOptions.WriteThrough & FileOptions.SequentialScan);

    string fileContents;
    using (StreamReader reader = new StreamReader(fileStream))
    {
        fileContents = reader.ReadToEnd();
    }


    bool assignedvariable = Convert.ToBoolean(fileContents);

assignedvariable will hold true if the file contains 1 and false if it contains 0.

Sorry if this has been answered already people post very fast here.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)