Error writing file stream

Asked

Viewed 977 times

2

The flow was not writable

You receive this exception when trying to change a file that is on Resource. Follows the code:

var assembly = Assembly.GetExecutingAssembly();
        Stream str = assembly.GetManifestResourceStream("PCCLC9875.versao.txt");

        String linha = "versao=" + INICIAL_VERSAO + ";revisao=00;compilacao=00";
        StreamWriter sw = new StreamWriter(str);
        sw.WriteLine(linha);
        sw.Close();
        str.Close();

I can only read, but when trying to change the error.

1 answer

3


That one stream is only available for reading even, you cannot try to save it. The error explicitly says this.

If you want to touch the metadata of Assembly is even possible, but it takes care and understand all the implications, which are not few.

Just to start the study on the subject:

  • I noticed, I thought some maneuver was missing in this code to work. Vlw

Browser other questions tagged

You are not signed in. Login or sign up in order to post.