Questions tagged [streamwriter]
StreamWriter is designed for character output in a particular encoding, whereas classes derived from Stream are designed for byte input and output.
streamwriter
1,530
questions
-1
votes
1
answer
40
views
no duplication of username does not work on my C# windows form, it only debugs the first array of my .txt file
Example .txt file output will be:
lastname|firstname|tintin|password|Manager
lastname|firstname|carley|password|Manager
If I try to register username 'tintin' and other data, it debugs it and says ...
1
vote
1
answer
134
views
Using Stax2 to escape special characters in Scala
I am trying to use Stax2 in order to write xml files with escaping special characters for the attributes.
When I am trying to achieve is an exact output like this:
<elem1 att1="This 
 ...
0
votes
0
answers
43
views
How to detect and print the encoding of a list of .sql files in a particular directory?
I have a list of .sql files that need to checked for their encoding before i make changes to them. They are either in utf 8 or utf 16. How can I make some changes to my code so that it enter code ...
2
votes
2
answers
302
views
My windows service in C# cannot write to file, when at the same time another C# app is trying to read the file
I have a Windows service in C# that is writing some data to a text file every 35ms. Normally everything was working fine. But recently I have programmed a simple windows forms app that is reading data ...
-1
votes
1
answer
124
views
Declaring new TextWriter with StreamWriter causes "System.IO.IOException: 'The process cannot access the file"
I have the file being used by another process. However I need to be able to save to it using TextWriter (C# .NET). What can I do to get around this?
("The Process cannot access the File error&...
1
vote
1
answer
147
views
How do I overwrite a text file line by line using StreamWriter WriteLine in c#
As part of my c# learning, I have a simple game on a console application. I have now added a text file to record the top score. It has 4 lines, date, number of attempts, time in minutes and additional ...
0
votes
1
answer
92
views
How to create multiple Files regarding to an object-attribute
A method receives an object list each entity has the following attributes:
name
room
The list contains, for example, the following objects:
name: pc01 room: a1
name: pc02 room: a1
name: pc01 room: ...
0
votes
0
answers
40
views
Should i close each substreams of filestream or closing filestream will be enought?
I readed a lot of topics about C# streams, but did not find my situation.
For learing purpose i did list-file json-bd like:
public sealed class JSONBD<T> : IDisposable {
private FileStream ...
1
vote
1
answer
46
views
How to store specific lines in a text file in a array (i.e 2 seperate bank accounts)
I am doing a ATM project for my computer science class and we are required to make an ATM that stores and reads accounts in a text file. I am stuck trying to figure out how I can get an array in the ...
0
votes
3
answers
107
views
How to overwrite a string in a text document
Doing a ATM Machine for my computer science project and I wanted to know how to overwrite a specific string of text in a text document.
Ex: The program asks the user how much they want to deposit; ...
0
votes
3
answers
398
views
C# MemoryStream csv file not writing
I'm writing something that will create a .csv file in memory and email it as an attachment. The code below successfully emails a .csv file, but it is empty. I'm sure I'm missing something simple...
...
0
votes
0
answers
25
views
XStream - data within a tag should be indented identically
I could use some help to get a better XML output. I hope to find a solution here! Couldn't find any solution for this.
That is my current output:
<java.util.Arrays_-ArrayList>
<a class=&...
1
vote
0
answers
41
views
Running cmd in a single textbox: how to put the cursor in the right place
I would like to run cmd.exe in one single textbox. When I use the code down below, everything works fine. The only thing is that the cursor is located below the prompt line, so:
C:\Users\myuser\...
-2
votes
1
answer
319
views
My json string is too long for the StreamWriter object [closed]
I'm trying to serialize a json string into an object.
I'm forced to use .net version 4.6.2 so I can't use the tools I would normally use.
I can't either user async because of the framework I'm working ...
1
vote
0
answers
52
views
Keeping multiple StreamWriters open or constatly open a new one?
So I have this application that needs to write to 12 different files 10 times a second a few thousand characters strings via different Tasks, figure something like this:
public static void Main()
{...