Skip to main content

All Questions

Tagged with
2 votes
3 answers
1k views

Write double to text file with dot separator

I need to write several doubles in text file with dot separator. I know, that this code is the solution: StreamWriter f = new StreamWriter(file, Encoding.ASCII, 128, false); double a = 1.057887; f....
Perotto's user avatar
  • 326
2 votes
0 answers
150 views

One process writes to file, I open it manualy (readonly) , I got exception "The process cannot access the file ..."?

I'm trying to allow just one process be able to write to a file and other processes could only read it , so I tried to open the file by: sw = new StreamWriter(File.Open(filepath, FileMode.Create, ...
MajdwWTD's user avatar
0 votes
2 answers
936 views

StreamWriter not flushing

I want to write a file of about 10 million rows. I'm using StreamWriter with a using statement, however it seems that the StreamWriter is not flushing. Here is my code: public void ExportRecords(...
Ayoub.A's user avatar
  • 2,063
-2 votes
1 answer
875 views

Java Process console output [duplicate]

I need help with process outputs. I working on a Process console, and if I write to process output, I need to close to write. If I want to send another command, I get "Stream closed" error. Can ...
S3nS3IW00's user avatar
0 votes
0 answers
512 views

The process cannot access the file because it is being used by another process. in c#

I am trying to Read a text file which is kept in a location of my PC Drive. The text file records Consist of 62 records but while Reading the file via Stream Reader in Catch I get following error ...
Sarthak Sharma's user avatar
0 votes
2 answers
6k views

c#: write to log file instead of Console.WriteLine

I like how Console.Writeline can be called from any part of a program, and it simply adds to the text already there. Is there a way to have that same ease but with writing to a text file instead? ...
MikeD's user avatar
  • 191
0 votes
1 answer
72 views

Creating multiple .txt files while restricting size of each

In my program, I collect bits of information on a massive scale, hundreds of thousands to millions of lines each. I am trying to limit each file I create to a certain size in order to be able to ...
William Henson's user avatar
1 vote
2 answers
1k views

Why wont console.SetOut(StreamWriter) write to my file?

Creating a console app and I'm trying to set up a log file to keep track of the activities of my application. This is how I'm setting up my FileStream and Writer. FileStream logstrm; StreamWriter ...
Dan Pederson's user avatar
1 vote
2 answers
417 views

C# file not being written to until the application finishes running

I've got a set of Specflow tests that I'm running and I'm trying to write the results so far to a file after each scenario finishes, and then I write again at the end of the entire test run. If I run ...
Steve's user avatar
  • 4,565
-3 votes
2 answers
188 views

Writing to the wrong txt file c#

I'm trying to write a code to write two text files. I created two subroutines for that because they are used in diferent ocasions. But, when I run the code, insted of writing in two text files, all ...
Rafael 's user avatar
7 votes
3 answers
57k views

How to Write to a file using StreamWriter?

in my Wpf app I'm using a class Person (that is a base class), and that contains a virtual method SaveData(), and other class Client that inherits from Person. How to override method SaveData() and ...
Wesley Heron's user avatar
2 votes
2 answers
2k views

StreamWriter stops in the middle of a WriteLine

I have a small application that checks all of the logs in a directory named after domain usernames and generates a results file with each username and the relevant first and surname for that user. ...
Chrayfish's user avatar
  • 157
0 votes
1 answer
261 views

Writing file using StreamWriter takes forever & auto-reloads the window

In my program, I'm using the Window_Loaded event to write my App.config file to the .exe's directory, as I'll be needing it for the connectionString in there. It works perfectly fine, however it ...
Yorrick's user avatar
  • 377
3 votes
4 answers
8k views

System.IO.IOException: The process cannot access the file '.txt' because it is being used by another process

I am using the next code to log errors of an web application. using (StreamWriter myStream = new StreamWriter(sLogFilePath, true)) { myStream.WriteLine(string.Format("{0, -45}{1, -25}{...
bucurvlad's user avatar
  • 119
1 vote
1 answer
1k views

Reading and Writing Data to Sequential Access Text File

I have an assignment to create a program in Microsoft Visual Studio Express 2012 that opens up a text file that we create and reads a list of names already in it. The program is supposed to take the ...
Stromboli's user avatar

15 30 50 per page