• home
  • forum
  • my
  • kt
  • download
  • Writing binary files using BinaryWriter

    Author: 2007-07-05 10:05:07 From:

    In this source code we will look at anyother new focus on ASP.NET. We could write binay files using BinaryWriter class. Let's see it on a sample code.



    public bool writeFile2Dsick(string strFilePath, byte[] strBinaryFile)
    {
            bool writtenFile = true;

            try
            {
                    using (FileStream objFileSystem = new FileStream(strFilePath, FileMode.CreateNew))
                    {
                        using (BinaryWriter objBinaryWriter = new BinaryWriter(objFileSystem))
                        {
                            objBinaryWriter.Write(strBinaryFile);
                        }
                    }
            }
            catch (IOException e)
            {
                    writtenFile = false;
            }

            return writtenFile;
    }

    discuss this topic to forum

    relation tutorial

    No relevant information

    Category

      NET (110)

    New

    Hot