Questions tagged [file.readalllines]

88 questions
0
votes
0 answers

Get files from iis logs folder

I would like to get all the logs files of my iis server and then send the content to a database. This is my code: string[] filePaths = Directory.GetFiles(@"C:\inetpub\logs\LogFiles\W3SVC1", "*.log", …
user2443476
  • 1,935
  • 9
  • 37
  • 66
0
votes
2 answers

How to: Add a string to a string array using File.ReadAllLines

How to: Add a string to a string array using File.ReadAllLines I think the question is clear: I want to add a new string to an existing string array, which gets ist content from a File.ReadAllLines. public void CreateNewFolder() { string[] lines…
sjantke
  • 605
  • 4
  • 9
  • 35
0
votes
1 answer

preserve special characters when writing all lines to text file

I have a few lines that contain special characters like these lines: CommunautéFinancièreAfricaineBEACFranc(XAF) CommunautéFinancièreAfricaineBCEAOFranc(XOF) But, when I write those lines into a text file, I get this as a…
Quoter
  • 4,236
  • 13
  • 47
  • 69
0
votes
4 answers

IndexOutOfRange exception

Why is this giving a IndexOutOfRange exception? string[] achCheckStr = File.ReadAllLines("achievements.txt"); if (achCheckStr[0] == ach1_StillBurning) // this is where the exception occurs { setAchievements(1); } if (achCheckStr[1] ==…
Simeon Laplev
  • 69
  • 1
  • 8
0
votes
1 answer

load txt file (m x n matrix) into 2d double array

I would like to load data from my txt file and store them in a 2D double array. I was trying something like this: String input = File.ReadAllText(@"E:\c\vstup.txt"); int k = 0, l = 0; double[][] resultout = new double[52][]; foreach (var row in…
user2886091
  • 725
  • 7
  • 16
  • 29
0
votes
2 answers

C#: Index was out of range, must be non-negative and less than the size of the collection

I did the following programming. Running the application shows an error message: Index was out of range. Must be non-negative and less than the size of the collection. EDIT: public void SetShortcuts() { List Verknüpfung = new…
sjantke
  • 605
  • 4
  • 9
  • 35
0
votes
2 answers

Read Multiple Specific Number of Lines in a Text File

I have the following type of data in a text file: Accumulated Earnings Tax. A tax penalty which is imposed on corporate earnings which are retained by the corporation for non- business related needs. Acquisition Cost. …
user3115728
  • 33
  • 1
  • 8
0
votes
3 answers

Replacing one specific line in a textfile in c#

I'm having a textfile say something like this: #TITLE:What's Up #ARTIST:4 Non Blondes - Whats Up #MP3:Four Non Blondes - Whats Up.mp3 #COVER:4 Non Blondes - Whats Up [CO].jpg #BACKGROUND:4 Non Blondes - Whats Up [CO].jpg #BPM:135 #GAP:32100 it's…
Baklap4
  • 3,914
  • 2
  • 29
  • 56
0
votes
1 answer

detecting/preventing error/deadlock when opening/reading text file

I am reading file with text contents on it. sample dictionary.txt contents: aa abaca abroad apple Snippet A: Dim path as String = Server.MapPath("dictionary.txt"); Dim dictionary() as String = {} Try { dictionary =…
jerjer
  • 8,694
  • 30
  • 36
0
votes
2 answers

Reading from a file into a string array. Then .Split the code into 3 more arrays

Alright. I'm having a problem. I have to load student data from text files, and put them into a class called Students. So far- const string STUDENT_FILE = @"C:Users\Etc\Etc\Students.txt"; Students students =…
Adam Cole
  • 1
  • 1
0
votes
1 answer

Reading comma-separated lines from textbox

I've been reading and reading tons of answers, modifying the code, and still i cant figure out how to solve this problem. I have a textbox that receives multiline comma-separated information from a .txt or .csv file. Example: Pearl…
-1
votes
1 answer

C# File ReadAllLine function disable after used dll(infinite wait)

The order of operation of my program is (Create file through dll call -> Read created file) But it doesn't work. After calling dll, the ReadAllLine function does not work and enters an infinite wait state. The cpu used is also 0. How do I run a…
-1
votes
1 answer

C# text file to string array and how to remove specific strings?

I need read a text file (10mb) and convert to .csv. See below portion of code: string DirPathForm = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);' string[] lines = File.ReadAllLines(DirPathForm +…
rcSilva
  • 1
  • 1
-1
votes
1 answer

Reading all lines from a HttpRequestedFileBase

i'm fetching a file by HttpRequestedFileBase, txt type, and I need to read each line in the file and store those line in variables to workin with them. But I'm wondering if i should convert the file to read it. Also I get some errors whiles I was…
-1
votes
2 answers

File.ReadAllLines() fails to read from a file that is opened by Excel

Say I open a file in Excel, I know I cannot write anything to it as it will be "locked" by Excel. But can I read it? Or that's not possible as well? I'm using the following code: If System.IO.File.Exists(file) Then output =…
user4234
  • 1,523
  • 1
  • 20
  • 37