Questions tagged [file-io]
File I/O is input/output that involves the file system. This could include performing operations on directories and files, such as creation and deletion, reading files, and writing output to files.
20,351
questions
1
vote
1answer
52 views
Why does Java show an incorrect lastModifiedTime? [closed]
I tried to get the lastModifiedTime from some files in Java. I used the following code:
File fPath = new File(path + folders + "\\" + pathname);
Path filePath = fPath.toPath();
...
0
votes
2answers
33 views
Visual C# When are Close() and Dispose() Needed?
I am new to Visual C# and don't understand when I need to use the Close() and Dispose() methods on FileStream and StreamReader objects. In the code snippet below, I open a file, read the first line, ...
0
votes
1answer
15 views
Writing text and intergers to a file, then reading from the file to calculate grade averages
This is what I am trying to display. These are the by products of 2 functions.
The first paragraph is the create() function which creates the "grades.txt" file. I think I got down pretty ...
0
votes
1answer
10 views
File Output: Writing Data for Multiple Executions?
I have this program. It uses a Lotka-Volterra ODE to predict predator and prey populations over a given period of time.
import random
import numpy as np
import matplotlib.pyplot as plt
from scipy ...
0
votes
0answers
17 views
How can I create iCal events and download/export event in .ics file in swift. I want file in Files in my iPhone
I tried to create an event from details getting from api response but failed, I want the event created in swift to write in a .ics file and then export to files in my iPhone. I Created text file and ...
0
votes
0answers
37 views
The exception message is printed in an infinite loop
I've been writing code that manually prints json (without the json library) after reading a CSV. It's to understand the structure for a project of this scale, which involves IO and Exception handling.
...
0
votes
0answers
22 views
How to decode whole number in .txt file into ascii using Python?
I'm still a beginner in studying Python 3.
I try to read a "New_Memtrace.txt" file which is contains a line of numbers like this :
...
0
votes
1answer
34 views
Multiple threads reading multiple .txt-files
I'm trying to make my program use multithreading to read in multiple .txt-files. Currently my implementation doesn't use threads, so it's just the main-program reading every .txt-file.
The program ...
1
vote
1answer
27 views
No memory leak, but confusing errors from valgrind when using malloc and file pointers
This reads from an already existing text file and creates 6 outfiles of little snippets from the infile. It works as predicted, but upon running valgrind I get multiple errors. However, there is no ...
0
votes
2answers
47 views
How can I read lines from a .txt file into two separate buffers?
I have two buffers char *buffer1 and char *buffer2 which are allocated on the heap, using malloc. From a text file, I want to read one line into buffer1 and the second line into buffer2, how can I ...
0
votes
1answer
53 views
How to write an ImmutableList<Number> to a file?
This should be pretty simple, but it takes about a minute to write about 40 MB. There's got to be a better way. I imagine there's a lot of hangup on casting the Number to a double, but I'm not sure ...
0
votes
1answer
47 views
Skip few lines during writing to file in python
I am using fileinput.FileInput to get read lines from a file.
for line in fileinput.FileInput("abc.txt",inplace=1):
if matching_string in line:
#print few lines
print line,
...
0
votes
0answers
20 views
Reading from a binary file and decoding using Python
I have a binary file from a mainframe which I'm trying to read using Python and produce a human readable text file. I'm still gathering more information about the file. What I do know is that the file ...
0
votes
1answer
25 views
PrintWriter not printing all data into my new text file
I have a project I have been working on for the past day and I can't seem to get my PrintWriter to write all of my data into the new text file.
Right now I have pretty much everything done, the ...
-2
votes
1answer
21 views
class president problem is now really my problem [closed]
def class_presidents(f_name):
S_president = []
J_president = []
real_max_j = 0
real_max_s = 0
with open(f_name) as file:
line = file.read().split()
for i in range(0,len(line),3):
if ...