Questions tagged [text-files]

The TXT file type is primarily associated with 'Text File'. Open in Notepad, WordPad, or many other programs designated as text editors. A true text file will be pure ASCII text with no formatting.

6722 questions
1
vote
2 answers

How do i write to a text file using java?

I have been using the "Learning Java 2nd Edtion" book to try make my java application write my input to a text file called properties. I have manipulated the text book example into my own code but still having problems trying to get it to work. I…
1
vote
1 answer

Cannot get user input to write to my text file in C# (error says path cannot be accessed because it is already in use)

I am at a loss as to what more I can do here. I have attempted to use namespace StreamReadWrite but that did not work. I have tried to use file.Close(); in different areas but the most that would happen is I'd get "Success" written in the console,…
1
vote
2 answers

Infinite loop when passing the name of a text file to more than one function

I'm trying to pass the name of a text file to two different functions so that they can operate on the file separately. The first loop works fine and produces the result that I expect, but the second function gets stuck in an infinite loop. Here is…
Marco Aiello
  • 179
  • 10
1
vote
1 answer

Python script not creating a text file when run in cmd

I'm trying to create a python script (with very limited knowledge) that will create a text document on the desktop of whoever runs the program. The section I have that should actually create the text file looks like so: save_path =…
FlipFlrpn
  • 11
  • 1
1
vote
0 answers

Decoding weird symbols in a text file

One of my text files has become seemingly encrypted with strange symbols such as ���, ל�9I, I'm wondering if there's a way to decode this? I've looked around for different ways and thought I was getting close a few times but I never found…
T-J King
  • 21
  • 5
1
vote
0 answers

Find number of occurrences and number of lines the value is in on a text file?

The scope of the problem is this: Search an array of string type for a value of string type that was read in from a text file and print the number of occurrences and print the number of lines that keyword occurs in. The expected output is: Keyword:…
Bowen
  • 55
  • 8
1
vote
1 answer

Is there a function similar to .replace() in Dominate library for Python?

I want to add HTML tags to text taken from a .txt file and then save as HTML. I'm trying to find any instances of a particular word, then 'replace' it with the same word inside an anchor tag. Something like this: import dominate from dominate.tags…
mcannon
  • 21
  • 4
1
vote
1 answer

Reading numbers from file to multidimensional arrays

I have integer numbers in a text file to be assigned to an array C[5][100]. My data is in this format: 17 40 35 24 50 15 31 38 48 18 16 44 41 10 26 50 48 20 24 12 48 24 34 39 ............... I am trying the code below but the error I get is this:…
larry79
  • 13
  • 3
1
vote
1 answer

How to move data onto a new line below header

I have looked through the 'similar questions' here and didn't see one that was close. I have a text file and headers that I write in Python, but when I open and then write data to the file it starts off immediately after the header, when I want the…
Windy71
  • 851
  • 1
  • 9
  • 30
1
vote
2 answers

reading each line of a text file preceded by line numbers

demoFile=open("lambpoem.txt","r") for i in demoFile: print(i) how do I modify the code in order for it to include the line number before the text in that line?
1
vote
1 answer

/storage/emulated/0/Notes/ (No such file or directory)?

I tried this link: How to create text file and insert data to that file on Android But, it says "No such file or directory". Can anybody help me please? Thanks in advance!
Pakz
  • 123
  • 2
  • 15
1
vote
1 answer

C++ getline for text file

Pretty simple really, I hope. I have opened a text file, and I want it to read the first line with getline. I want it to take all the integers in that line, separated by commas, and add them together to be stored in a variable. However, I'm not…
1
vote
1 answer

Need help in finding where to start looking to fix my code. When reading large files it gets stuck

I'm trying to read a large text file of about 7516 lines of text. When I read a smaller file (9 lines) the program works fine. But with the large file it seems to get caught in something and just keeps running without anything actually…
Voz zzz
  • 25
  • 4
1
vote
2 answers

Clearing JTextfields to write multiple data to txt file

excuse the probably simple question (and the terrible layout methods). The code I have successfully writes inputted data to a txt file and on clicking "submit" closes the input window, leaving the "menu" open, with options to add a user (this code)…
Chris Brown
  • 4,445
  • 3
  • 28
  • 36
1
vote
2 answers

How to Clear variables from JTextFields without closing whole program?

I have created a text file in which to store some variables which are taken from text fields. But in order to submit new variables to this text file, I need to close my program and reopen it. The dispose(); command closes the JFrame taking me to my…
Darren Burgess
  • 4,200
  • 6
  • 27
  • 43