Skip to main content

All Questions

Tagged with
0 votes
1 answer
206 views

C# System.IO : The process cannot access the file path because it is being used by another process

I am trying to debug the code for uploading the .xlsx file through my application in my local system. At the time of appending log data to the log file this exception The process cannot access the ...
Akbar Shaik's user avatar
0 votes
1 answer
127 views

How to access a relative URI using StreamReader in C#

So I'm trying to read/write to a generic .dat file which contains plain text. I've been trying to do it with StreamReader/Writer as this seemed to be the neatest way of doing things. The data.dat file ...
AuthorBrotherGames's user avatar
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: ...
3xcelsior's user avatar
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() {...
MrBott_a's user avatar
-1 votes
1 answer
55 views

How can I be %100 sure that writing to a text file has been finished in C#, so that I can proceed with another operation?

In my C# project, i have to write some info to a file with streamwriter, and afterwards I want to call a method. But I have to be % 100 sure that the writing process has been finished, otherwise a ...
Mdarende's user avatar
  • 661
0 votes
1 answer
84 views

How to write into a file with StreamWriter in c#?

I can't write into a file correctly. The program reads the file and displays it on console with no problem, but I have some issues trying to write into this file. I have this method: public static ...
bri's user avatar
  • 15
-1 votes
1 answer
520 views

Could not found the path for create and write file

My code is after run on Azure it say: { "Message": "Cannot create 'D:\\home\\site\\wwwroot\\DataFile' because a file or directory with the same name already exists." } how to ...
Kelvin's user avatar
  • 199
1 vote
1 answer
601 views

Why is c# creating a file before any file stream is created?

Background: I am creating an avaloniaUI project and in it I have a json config with a class that serializes and deserializes it on initialization and editing. If the file can't be found on ...
Artemis Venatrix's user avatar
0 votes
0 answers
489 views

How to Read Contents of an Audio File to a string

I'm working on an app that needs to write the contents of a music file to StreamWriter which is used to create a copy of the file. My first attempt resulted in a file that couldn't be played. ...
Alwaysdeadfred's user avatar
2 votes
2 answers
659 views

C# StreamWriter not closing the file after appending

So im using a timer which appends logs to a log file every minute. For some reason I get the error that the file is in use even tho it shouldn't. It works twice and then the third time I an error. ...
Elvis Detters's user avatar
0 votes
1 answer
347 views

How can I read a text file and write its values to an array

I have a text file with values and I need to read them. The first line is the size of my array and the second line has values that I need to put into to an array. My main looks like: public static ...
Robert Pietraszewski's user avatar
0 votes
1 answer
90 views

File.ReadLines keeps file locked after reading it and i can't write into it

For some reason File.ReadLines keeps the file that im reading locked, and when i am trying to write text into it using a streamWriter, i get an error that it is being used by another process. If i don'...
Smoking Diesel GR's user avatar
0 votes
1 answer
1k views

Empty File Created without text in .txt file in .NET Core

[HttpPost] public FileResult DownloadFile(int id) { using (MemoryStream ms = new MemoryStream()) { var sw = new StreamWriter(ms); sw.Write("Hi"); ...
CoderGuy's user avatar
1 vote
2 answers
6k views

FileStream vs StreamReader and StreamWriter - what's the difference? [duplicate]

What functionality is allowed via StreamReader and StreamWriter when working with files which can't be done via FileStream, or vice versa? I checked the docs and they both have read / write options, ...
Aviv Vetaro's user avatar
0 votes
1 answer
360 views

How to write a Text to a Text File in C# on Android

I want to write a code in C# that reads a text file in Android and if it doesn't exist, create it. I want my application to read the same file everytime I run my App and create that file the first ...
Parham Torabi's user avatar

15 30 50 per page
1
2 3 4 5
10