Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8400323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:32:11+00:00 2026-06-09T21:32:11+00:00

I am trying to do something very simple. In finding the default buffersize associated

  • 0

I am trying to do something very simple.

In finding the default buffersize associated with the StreamWriter(string path) constructor too small for the information I am logging, I am attempting to use the following constructor:

public StreamWriter(
    string path,
    bool append,
    Encoding encoding,
    int bufferSize
)

The resulting log file is completely empty – which is worse.

NOTE: My original post cited the error “Error: Attempted to read past end of stream” , but this relates to functionality later in the method, which I can’t log information for because of this log file problem.

Here is the old constructor usage from my code:

drawGameBoardLog = new StreamWriter(debugFileName);

And here is the new constructor which ironically makes things worse:

drawGameBoardLog = new StreamWriter(debugFileName, false, System.Text.Encoding.Default, 65535);

I am totally baffled by this.

UPDATE: Some more detail:

This is the start of the method for which I am logging activity:

    public void DrawGameBoard()
    {
        StreamWriter drawGameBoardLog;
        bool debug = true;

        // Logging---------------------------------------------------------------------------------
        // Build timestamp string
        DateTime currentDateTime = DateTime.Now;
        string timeStampString = currentDateTime.ToString("ddMMyyyy_HHmmss");

        // Build filename, concat timestamp and .txt extension.
        string debugFileName = "D:\\Programming\\PacmanLogs\\DrawGameBoard"+timeStampString+".txt";

        // Create filestream and pass this to a stream writer, setting a nice big buffer.
        drawGameBoardLog = new StreamWriter(debugFileName, false, System.Text.Encoding.Default, 65535);
        //drawGameBoardLog = new StreamWriter(debugFileName);

        // Write to the file:
        drawGameBoardLog.WriteLine(DateTime.Now);
        drawGameBoardLog.WriteLine("timeStampString = {0}",timeStampString);
        // -------------------------------------------------------------------------------------------

        if(debug){drawGameBoardLog.WriteLine("DrawGameBoard()...");}

The line “DrawGameBoard()…” is not even appearing when using the StreamWriter constructor which accepts path, append, encoding, and buffersize. Whereas before I was getting content which took the file size to 1K. Here is the log file up to that point (I’m starting out with graphics programming by the way):

19/08/2012 14:13:21
timeStampString = 19082012_141321
DrawGameBoard()...
noOfIndexes = [6], noOfVertices = [4]
...just set stremSize = [80]
...creating vertices DataStream...
...building Matrices...
...Scaling matrix DONE...
...Rotation matrix DONE...
...Translation matrix DONE...
...Orthogonal matrix DONE...
...Perspective matrix DONE...
...COMBINED matrix DONE...
...creating Vector3 and Vector2 arrays to hold positions and texture coords...
...Writing Texture coords....
...Building Index Array (order of vertices to be drawn for a quad)....
...Declaring indicesStream. Set size of stream to [24]....
...Created data stream for indices OK. Now writing indices array to it....
...DONE. Just set position back to ZERO...
...Created new index buffer OK....
...configure the Input Assembler....
...Getting Vectors for position [0,0]...
...Got Vectors into myVectorPositions....
myVectorPositions[0] = [X:0 Y:0 Z:0.5]
myVectorPositions[1] = [X:20 Y:0 Z:0.5]
myVectorPositions[2] = [X:0 Y:20 Z:0.5]

The default buffer size kicks in right there.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T21:32:12+00:00Added an answer on June 9, 2026 at 9:32 pm

    You are not closing your StreamWriter. At the end type:

    drawGameBoardLog.Close();

    Or use a using block:

    using(StreamWriter sw = new StreamWriter(path))
    {
         sw.WriteLine("Sth");
    }
    

    Or use a try finally:

    StreamWriter sw;
    
    try
    {
       sw = new StreamWriter(path);
       sw.WriteLine("sth");
    
    }
    finally
    {
       sw.Close();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying something very simple: MYPATH=/path/I/want/to/go/to/ ... cd $MYPATH No good. I've tried various
I'm trying something very simple. Upon page load the data in content div is
I'm trying to do something very simple, yet I can't seem to find the
I am trying to accomplish something very simple, and I'm hoping someone can point
I am new to Raphael and am trying to do something very simple, but
I am new to Raphael and am trying to do something very simple, but
Hey all, I am trying to accomplish something very simple yet getting an error
I am using flask , and trying to do something very simple using the
I'm trying to do something which is probably very simple, I have a directory
Currently I am trying something very simple. I am looking through an XML document

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.