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
8
votes
2
answers
14k
views
FileStream's FileMode.OpenOrCreate overwrites file
Documentation says FileMode.OpenOrCreate "specifies that the operating system should open a file if it exists; otherwise, a new file should be created", which sounds like it will open the ...
-1
votes
1
answer
57
views
OutOfMemory Excpetion when write a large txt file vb.net
In my program recovering data from the db (there are over 500k lines) I create a path with this data and write it in a file (in the db as a where clause I insert what the date range is, the lower it ...
2
votes
1
answer
913
views
Ident Tabs for Multiple New Line String Variable in Net Core
How do I ident a set of lines when writing to a file, with a tabs? I need to go through each line in the variable and create 8 spaces or two tabs for each line, when writing to the new file.
If the ...
1
vote
1
answer
58
views
Delete a string value in a CSV File with C#
I deleted my previous post in hopes this one is better and clear to be able to get help. I appreciate it.
So far, with my code I am uploading a CSV file to format it as: I have skip the headers and ...
0
votes
2
answers
42
views
need to close after FILE.READLINES
I need to read all content of a file but keep only some of the content and append new content. So I tried to use READLINES filter the lines I need to keep then rewrite the file with the kept lines and ...
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
1
answer
177
views
ASP.NET - HttpResponse.WriteAsync() vs HttpResponse.Body.WriteAsync() vs HttpResponse.BodyWriter.WriteAsync()
In ASP.NET one has three options (that I know of) for writing directly to the response buffer.
Given the following data:
var str = "Hello World";
var bytes = Encoding.UTF8.GetBytes(str);
We ...
3
votes
3
answers
4k
views
Write txt file in linux for .net Core (Docker)
I am new in Linux and my API was created in .net core and running in Docker. The system i create will write/create a txt file that will input all errors logged in the API. My code to write is this
...
-1
votes
3
answers
2k
views
How to fix StreamWriter error "cannot implicitly convert type string to System.IO.StreamWriter"
I'm using C# in Visual Studio 2017 Community.
I have a working, fully functional program that I am trying to optimize. In a nutshell, the program reads text and numbers from text files, does some ...
26
votes
2
answers
12k
views
StreamWriter end line with Lf rather than CrLf
I'm using StreamWriter to output a text file, but I would like to end my WriteLine with Lf rather than the default CrLf. Is there an easy way to do this using a parameter built into StreamWriter?
14
votes
3
answers
13k
views
C# I/O - Difference between System.IO.File and StreamWriter/StreamReader?
Assuming I am interested only in dealing with text files, what specific advantages or disadvantages does System.IO.File methods provide when compared to StreamWriter?
Are there any performance ...
0
votes
0
answers
20
views
NamedPipeClientStream stalls after the first ReadLineAsync, and stalls on the first WriteLineAsync
I chose NamedPipes over TCP because I needed two applications on the same machine to talk to each other. I wanted exceedingly simple, quick, and easy, unfortunately it has proven to be the opposite.
...
0
votes
1
answer
96
views
streamwriter and special characters & ’
To my understanding when I write a file using notepad++
I can write the symbols ’ and & without a problem in a text file.
Both are valid ASCI symbols and they are not that exotic either.
& = ...
20
votes
1
answer
9k
views
Why should asyncio.StreamWriter.drain be explicitly called?
From doc:
write(data)
Write data to the stream.
This method is not subject to flow control. Calls to write() should be followed by drain().
coroutine drain()
Wait until it is appropriate to resume ...
0
votes
1
answer
62
views
C# StreamWriter with using-block inside a while loop intermittently fails on slow network drive
I have a logging class in which I spawn a Task to append all messages from a BlockingCollection<string> to the log file, sleep two seconds, and repeat infinitely, until the fifo is completed.
...