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.
21,058
questions
0
votes
1
answer
33
views
i want to know why it wont print whenever i write to a buffer
i'm trying to understand why i can't write to a buffer, read from a buffer, and write it to another file;
int main()
{
int fd, fz;
char *buff;
fd = open("./text", O_CREAT | ...
-2
votes
0
answers
26
views
How to avoid slowing down the system when deleting a lot of files in a folder (exclude subdirectories) using Java [closed]
In my system, there are a lot of log files (from 10000 to 100000 files) that I have to handle directly and delete afterward. If I use the for loop function to delete, will it slow down my system? Is ...
0
votes
0
answers
7
views
What is measured by changing the `file-block-size` parameter in sysbench fileio test?
I was trying to measure the system performance with sysbench fileio test. However, I'm not sure what am I playing with when I change that file-block-size parameter.
Previously I thought it was the ...
-1
votes
0
answers
19
views
read values from file with python
I have a data file like this (containing empty lines):
4
0.0 1.1 2.2 3.3
100 101 102 103
10.0 10.1 10.2 10.3
100 200 300 400
I am able to read this with the following python code:
file = open('test....
0
votes
1
answer
27
views
Unable to Save Data to HDF5 File using fsspec in Python
I'm trying to save data (3D numpy array) to an HDF5 file using fsspec in Python, but I'm encountering issues and I am unable to successfully write the data to the file.
The bigger picture is I am ...
0
votes
2
answers
54
views
Retrieving data from two separate files and writing to a third csv file
I have been thinking all day how to approach this task. I have these two files:
user.plt: contains timestamped GPS trajectory of user.
label.txt: contains information about mode of travel used to ...
-1
votes
0
answers
33
views
Trying to read a block of text from a file and getting more text than intended
I have a text file called addsys.txt with the following contents
# INFO:
name = Test name
dim = 2
outname = test_outname
inputname = TOsc
group = OS
# COMMENTS:
OMEGA = par[0]
gamma = par[1]
zeta = ...
0
votes
0
answers
72
views
Why doesn't TPath.GetAttributes return faSymLink for my symbolic link?
TFile.IntegerToFileAttributes does not return TFileAttribute.faSymLink for me.
I tried using TPath.GetAttributes on a symbolic link to another directory.
I was expecting that the returned attributes ...
0
votes
0
answers
40
views
File Buffer doesn't flush on a Network Drive
I have written a C++ program to write to a file on a network drive path mapped to "O:\Temp\test.csv".
#include <iostream>
#include <fstream>
#include <windows.h>
int main()...
0
votes
1
answer
32
views
System command to mail text output
AS400 CLLE SQL
How can i create program which will count no of active subsystem in wrksbs command and give the output on mail text(not attachment) in clle as400? How to run system command in clle ...
3
votes
2
answers
79
views
Why does ungetc have a parameter to specify which character to push back?
In my current understanding, you're supposed to call ungetc when you want to "un-get" the most recent character that you got from the stream, sort of like reversing the effect of an ...
1
vote
2
answers
53
views
fseek is returning -1 in "w" mode and making file blank in C program
Here is the code:
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char* argv[])
{
FILE* fp = fopen("sample.txt", "w");
...
0
votes
1
answer
23
views
Why am I getting a 'closed' exception when trying to write OkHttp response to .json file in Kotlin?
I am trying to make a Currency Conversion App in Kotlin and have a problem with updating my values. The connection works fine but I cannnot write it into an .json file.
Here is my Code:
val ...
0
votes
2
answers
78
views
Spring boot MultipartFile transferTo not working
The line file1.createNewFile(); creates a new file, but the file.transferTo(file1); does not transfer the contents of the MultipartFile to file1.
Is there a way to make the transferTo method work?
@...
-1
votes
1
answer
49
views
Using ifstream cannot get right size of Binary file
In a fragment of my application I need to get the size of binary file (Number of bytes). My function uses get() method and increments while the method returns True.
My application firstly reads the ...
0
votes
2
answers
60
views
Finding frequency of characters in a very large file
I have a text file that is ~4G big. I want to get the frequency of each character. Some lines start with a special character and they will be ignored. What is the fastest way to do this in python? I ...
0
votes
0
answers
53
views
File.WriteAllLines is generating exception System.UnauthorizedAccessException [closed]
I want to read all lines of 2 .txt files and store them line by line in 2 different string lists in code and then I want to write to those files a new list of strings
I wrote this code:
if (File....
0
votes
0
answers
35
views
Python - Cannot find file in system path?
I am trying to move into Python and am used to using MATLAB. In MATLAB I am used to adding folders to the current working directory or path. So I would normally add a particular folder + all the sub ...
0
votes
1
answer
19
views
pipe powershell script output to file
Scratching my head how to make this script send the output of the script to a text file identifying what groups were removed and what were not, below is my script anyone able to assist with what I am ...
0
votes
0
answers
20
views
How to extract data from a parquet input stream or any other parquet stream such that no fileIO is involved?
I am unable to extract data from java inputstream containing Parquet file data without creating a file. Imagine I have to write a method which reads the parquet data from a java input stream without ...
-2
votes
1
answer
31
views
Is data written to a OutputStream safe to assume always valid? [closed]
Is there any potential for Java/Android to incorrectly write data with an OutputStream?
I occasionally have reports from users that generated files don't open, and upon inspection, they seem to go &...
1
vote
2
answers
46
views
Reading filenames from directory into a .csv file using python while maintaining the order that they're in
The title says it all. Its pretty easy to do it normally, but it has to maintain the original order from the folder.
I've got some files (1000 all told) that I've got to put into a .csv.
The filenames ...
0
votes
0
answers
32
views
Memory access violation after reading all objects from binary file and display them on the concole
I have a class Tort(representation of the cake), in the main() in the switch statement I call the function displayAllTorts() which should read the objects of Tort from the file (objects were written ...
0
votes
1
answer
37
views
In Haskell's Turtle libarary, how to copy a file, but preserve the file date
I copy a file with the Turtle library. I do so like this:
...
do
TU.cp oldname newname
...
However this sets the date of the copied file to the current time - how can I keep the original ...
0
votes
1
answer
22
views
Apace Beam's FileIO.Match step is stuck in the Dataflow job while matching a large number of files from GCS
I'm building a streaming pipeline to process the log files stored in a GCS bucket and insert into BigQuery using the Dataflow streaming job. Pipeline just works fine when there are only a few 100 ...
0
votes
0
answers
36
views
VB .NET Reading all lines in file
I have a file with 3 lines:
20220203A|47332580|4500|20220206|0245|||||||||||||||||||||
20220203B|47237607|4500|20220206|0243|||||||||||||||||||||
20220203C|47383542|4500|20220206|0241||||||||||||||...
-2
votes
1
answer
36
views
Average lines of a file if they are similar
I have a file containing data to be plotted but the curve is not smooth due to issue during the profile extraction (see attached picture)..
I would like to average the data when necessary to obtain a ...
0
votes
0
answers
21
views
Is there anyway to store a moviePy clip in "session" during flask application runtime?
I'm working on a flask website that works with moviepy.
The basic flow is:
User uploads videos(s), if more than one video uploaded these get combined into one.
Save the uploaded video onto disk usig ...
0
votes
2
answers
75
views
reading text file columns one after another in a 1D array
I have tried to read the following text file using Fortran. The text file has 24 rows and 15 columns. I want to put all the data in a single column array z. I wanted to read the 1st column then the ...
0
votes
0
answers
26
views
How do I recapture lossless data from input via encoding
I am having a tough time recreating a file from a compressed form I have created. I need it to be lossless. I'm sure I have the data, and I'm sure because I have full size output to the proxied source ...
0
votes
0
answers
65
views
Apache poi Java Excel - file is open in Java(TM) Platform SE binary
I recently worked on my project which needs to use java to write excel files. I choose Apache poi and followed the example online, but seems like there was an issue with the close method for the ...
-1
votes
1
answer
45
views
How to extract multiple dictionaries from a text file with no new line using Python?
I have a text file with the following type of data:
{'key1':'data','key2':'data','key3':'data','key4':{'subkey1':'data','subkey2':'data'}}, {'key1':'data','key2':'data','key3':'data','key4':{'subkey1':...
1
vote
1
answer
54
views
Uploading multiple files - Rails and React
I'm trying to upload multiple files as part of an assignment that a tutor would upload for a student. The student would then be able to click the link and download the files to their computer.
This is ...
0
votes
0
answers
20
views
PdfWriter not appending data
lowagie PdfWriter is not appending data but overwriting it whenever writeData is called.
How can we append data?
void writeData(List<org.bson.Document> item){
boolean isExistingFile = Files....
0
votes
0
answers
52
views
Reading SAS based software output (TEXT files only, NOT SAS 7bdat files) into R
I have received data which is the output of a proprietary tool written on top of SAS. I don't have access to the tool, only to the outputs. I think it runs on some version of Windows. It is, in ...
0
votes
3
answers
75
views
Why doesn't FileExists(path) work when the searched file is in Programs (x86) folder?
I am not sure why or what a work around could be, so basic thing I want to check if a specific .exe exist and if so continue else bring error message.
Private Sub Button1_Click(sender As Object, e As ...
0
votes
1
answer
25
views
Even though the try block can read the file, the method still returns null. How do I get it to return the expected string?
So the test runs to see if the method can read the file and return its contents. I've tried different alterations and this is what I've come to so far. I was able to print out all the necessary ...
1
vote
0
answers
30
views
How to read the .sif files using pyspark
How can I read the hetionet-v1.0-edges.sif.gz file using pyspark?
url = "https://github.com/hetio/hetionet/raw/master/hetnet/tsv/hetionet-v1.0-edges.sif.gz"
response = requests.get(url)
...
0
votes
1
answer
52
views
How to get a C file descriptor that doesn't output to anywhere
I have a legacy program which outputs to either stdout or a file if given a -o option.
if (<-o option exists>) {
fn = fopen(file_name, "w");
} else {
fn = stdout;
}
I want to ...
1
vote
2
answers
53
views
How to handle saving game data for a simple Java game
Im working on a Minesweeper clone and I want the user to be able to save their fastest solve times to a .txt file. I have it set up and working inside Eclipse with the following code in my i/o class:
...
0
votes
0
answers
43
views
How to handle non-ASCII characters when reading a file in a Python script? [duplicate]
I am working on a Python script that needs to read data from a file containing non-ASCII characters. However, when I run my script, I encounter the following error message:
"UnicodeDecodeError: '...
-2
votes
1
answer
37
views
Read and loop through all contents in a file separated by tab and put all the words in an ArrayList [closed]
I'm working on a java project for school and I want to read all words in a text file and store it in an Arraylist. Here is a small sample of the text file:
1876 Gore Vidal Random House 4/11/...
0
votes
1
answer
40
views
How to use generator funtion in parallel to the main loop in python
Expanding on Jeff Bauer's answer https://stackoverflow.com/a/5420116/11306525.
My use case is to read a file continuously, save entries in a list if it matches certain regex, and perform operations on ...
-1
votes
1
answer
76
views
`list-directed I/O syntax error` when reading an integer value from a file to a real variable
For example:
real :: a(3)
open(newunit=u,file='t.txt', status='old')
do j=1,3
read(u,*) a(j)
enddo
Data in 't.txt' looks like:
1
2
3
Code compiled by ifort gives the following error:
forrtl: ...
0
votes
1
answer
64
views
trying to write to a file with php
I am trying to write to a file using php and html, I am running a XAMPP local server on my computer I a wrote some html and php code I found online on YouTube, I am also on Mac just to let people know....
0
votes
1
answer
51
views
Writing of output into a file
Am trying to create a worldlist with a limited number of duplicate peer line when a character can only repeat not more than 3 time's in a line.
Accepted: 10101075
Unacceptable: 11101110
Then I came ...
2
votes
2
answers
57
views
String read in by fgets doesn't write newline with fputs
I am writing a program that takes in user input on a person's details that consists of name, ID and phone number. I am limiting my ID and phone number to be maximum of 14 and 13 characters ...
0
votes
2
answers
44
views
printf command not working after a specific point in my program
I'm working on a program with a 2D array of 365 data points, where one of the things we need to do is find the mean of the data and print it to a file and also to the command window.
#include <...
0
votes
0
answers
48
views
Program behaves differently when read same data from console and file
This is my code.
It is for solving single-source shortest path problem using Dijkstra algorithm.
#include <cstdio>
using namespace std;
int mp[2505][2505];
int n, m, s, t;
const int INF = ...
0
votes
0
answers
23
views
Can't figure out how to extract data from excel-to-txt file
I had an excel file containing data I had to use. For the purposes of a project, I converted it to .txt since we are required to use .txt, not .xlsx. I'm not sure what to use as a separator so that I ...