Completely Free .NET word API

Resources » Code Snippets » C# Syntax

Writing string content to a file

Updated: Category: C# Syntax
Author: Member Level: BronzePoints: 7

This code describes how to write content to a file

StringBuilder stringData = new StringBuilder();
stringData= "Any String Content.It may be custom built XML String/Web method Call etc..,";
FileStream fs = new FileStream("Complete File Path", FileMode.Create);
byte[] buffer = new byte[stringData.Length];
for (int i = 0; i < stringData.Length; i++)
buffer[i] = (byte)stringData[i];
fs.Write(buffer, 0, buffer.Length);

Did you like this resource? Share it with your friends and show your love!

Responses to "Writing string content to a file"

Post Comment:

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)

    Type the numbers and letters shown on the left.

    Submit Article     Return to Article Index
    Subscribe to Subscribers
    Active Members
    TodayLast 7 Daysmore...

    Awards & Gifts
    Talk to Webmaster Tony John

    Online Members

    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India