Questions tagged [file.readalllines]
88 questions
0
votes
2 answers
Large Text File 1 > GB Frequency of KeyValuePair using File.ReadLine
I'm new to C# and object-oriented programming in general. I have an application which parses a very large text file.
I have two dictionaries:
Dictionary parsingDict //key: original value, value: replacement
Dictionary…

Tango
- 386
- 1
- 6
- 29
0
votes
3 answers
reading file to a list
i have a text file like this
a1,b1,30.04.2017
c1,d1,30.05.2017
i want to add every line to a list, the first two columns will be string variables s1 and s2 and the third one will be converted to a variable showing a date
i am not experienced at…

kenan
- 15
- 6
0
votes
1 answer
Why does my file sometimes disappear in the process of reading from it or writing to it?
I have an app that reads from text files to determine which reports should be generated. It works as it should most of the time, but once in awhile, the program deletes one of the text files it reads from/writes to. Then an exception is thrown…

B. Clay Shannon-B. Crow Raven
- 8,547
- 144
- 472
- 862
0
votes
3 answers
VBS don't read whole text file
If objFSO.GetFile(tempFolder & "\list2.txt").Size > 0 Then
contents = objFSO.OpenTextFile(tempFolder & "\list2.txt", 1, False).ReadAll
Select Case MsgBox ("Link" & contents &…

Rıdvan Çetin
- 183
- 5
- 16
0
votes
1 answer
How to properly use readAllLines in Java?
I am trying to read every line in a file and then splitting them. It is the first time I do this and I am not sure if I am using the right Charset or path to the file. Thank you for your help! Here is my try:
The path (ruta) in main is specified…

Eduardo Ramos
- 91
- 13
0
votes
1 answer
c# How to read file with space and other characters like /
I have a filer with name Names.txt
and with following data
David One And Two/Three
Alex One Two Four And Five/Six
Amanda Two Seven/Ten
Micheal Seven/Nine
And here is my code:
string[] Name = File.ReadAllLines("Names.txt",…

Jonas Willander
- 432
- 3
- 9
- 29
0
votes
3 answers
DirectoryNotFoundException was unhandled while the use of ReadAllLines C#
The following piece of code is the code used to call the .txt-file and turn it into strings.
string[] lines = System.IO.File.ReadAllLines(@"C:\This PC\Documents\Visual Studio 2015\Projects\test_read_txt\bin\Debug\read.txt");
Why wont C# recognize…

Erik Lenstrup
- 37
- 7
0
votes
1 answer
Python Re-ordering the lines in a dat file by string
Sorry if this is a repeat but I can't find it for now.
Basically I am opening and reading a dat file which contains a load of paths that I need to loop through to get certain information.
Each of the lines in the base.dat file contains…

Ciara Mackellar
- 3
- 2
0
votes
0 answers
C#: "Unable to load" file error on executing System.IO.File.WriteAllLines( ls_PathAndFile, ls_aLineText )
While overwriting an xml file through following steps:
Read all contents of an xml file in an string array: string[]
ls_aLineText = System.IO.File.ReadAllLines( ls_PathAndFile );
Overwritten contents of the ls_aLineText array
Overwriting the xml…

Vivek
- 1
0
votes
2 answers
Proof Reading .CSV per line
CSVHelper and FileHelper is not an option
I have a .csv export that I need to check for consistency structured like the below
Reference,Date,EntryID
ABC123,08/09/2015,123
ABD234,08/09/2015,124
XYZ987,07/09/2015,125
QWE456,08/09/2016,126
I can use…

user001
- 415
- 1
- 7
- 22
0
votes
2 answers
Date Issue with c# File.ReadAllLines()
for some reason it seems File.ReadAllLines has an uncanny issue converting all dates from yyyy/mm/dd to yy/mm/dd.
Problem is i am working with historic data that can pull back all the way past 1901, thus causing an issue with shorthand date…

LokizFenrir
- 340
- 3
- 9
0
votes
2 answers
Why replaceAll method is not working?
I read from file like this:
List list = Files.readAllLines(Paths.get("file.csv"));
After that I try to call replaceAll method on every string in the list, but it doesn't work with any regex and replacement string. Although, when I apply…

Denis Yakovenko
- 3,241
- 6
- 48
- 82
0
votes
1 answer
WriteAllText help in Visual Studio 2012
so I have a program I'm working on and I need to read lines of a .ini file then write user-defined text to a certain line in that file.
So far some of my code is:
Dim File As String = ".\TestFile.ini"
Dim FileText As String
Dim NewText As…

LukeSC1993
- 43
- 1
- 7
0
votes
2 answers
Read previous line using File.ReadLines
I want to read a text file from last line because it could be big size and just want to check today's log content.
I'm using File.ReadLines() and success to read last line.
How can I read the previous line?
Or is there any way to get the current…

Elena
- 3
- 1
- 3
0
votes
1 answer
Can't read file using File.ReadAllLines
I am trying to make a button check each line of the file in openFileDialog1.FileName and if it contains one of the strings, "LCD" or "laser" and "on" on the same line, or if it contains "laser" and "off" on the same line and the string ".end" and…

olle olofsson
- 11
- 6