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

  • Home
  • SEARCH
  • 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 8238039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:40:40+00:00 2026-06-07T19:40:40+00:00

I have two filestreams which collects different information from different files: FileStream dataStruc =

  • 0

I have two filestreams which collects different information from different files:

FileStream dataStruc = new FileStream("c:\\temp\\dataStruc.txt", FileMode.Create, FileAccess.ReadWrite);

FileStream csvFile = new FileStream("c:\\temp\\" + fileName + ".txt", FileMode.Create, FileAccess.ReadWrite);

StreamWriter sw = new StreamWriter(csvFile);
StreamWriter swc = new StreamWriter(dataStruc);

when both streamwriters are used to get the same piece of information like shown below:

sw.WriteLine(sheet); 
swc.WriteLine(sheet);

then sw streamwriter has information from file. Have I set up my filestreams incorrectly?

  • 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-07T19:40:43+00:00Added an answer on June 7, 2026 at 7:40 pm

    Assuming you don’t get any exceptions/errors and that basic stuff like the correct path for the csvFile FileStream is verified and found to be correct: Try adding a Flush() or propery closing the stream using Close(). Even better: use a using statement.

    EDIT
    After reading your question again: are you sure you just didn’t switch the filestreams?

    StreamWriter sw = new StreamWriter(csvFile);
    StreamWriter swc = new StreamWriter(dataStruc);
    

    as opposed to

    StreamWriter sw = new StreamWriter(dataStruc);
    StreamWriter swc = new StreamWriter(csvFile);
    

    Your question and description is rather vague: “both streamwriters are used to get the same piece of information“. How would stream writers be used to get information? Also: “sw streamwriter has information from file“: could you be more specific? This doesn’t make sense.

    Whatever the case may be; use the debugger luke!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two classes (MVC view model) which inherits from one abstract base class.
I have two xml files with the same data but different tags. I need
Hi guys I have a dictionary which has to be shared between two different
From what I've read nothing explicitly says you cannot have two FILESTREAM columns in
Have two folders with approx. 150 java property files. In a shell script, how
I have two files client.php and server.php. The client file send a HTTP request
I have noticed two different approaches to writing out data to an XML file
I have a two huge text files whose format is as below. File 1:
I have two DataGridViews that have the same column schema (although two different DataViews
Have two files with struct definitions. Header: typedef struct _InputData InputData; extern InputData input_data;

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.