Skip to main content

Questions tagged [file]

A block of arbitrary information, or resource for storing information, accessible by the string-based name or path. Files are available to computer programs and are usually based on some kind of persistent storage.

Filter by
Sorted by
Tagged with
3 votes
2 answers
88 views

Managing file paths in a python Data Science project

When doing Data Science projects, I often have to load data and metadata, and output results, plots, logs, etc. Therefore I have to handle all the file paths from where to load the input and write the ...
Alessandro Cesa's user avatar
2 votes
3 answers
107 views

Get histogram of bytes in any set of files in Java - take III

(This post is the continuation of Get histogram of bytes in any set of files in Java - take II.) This time my code looks like as follows: ...
coderodde's user avatar
  • 29.8k
3 votes
1 answer
138 views

Get histogram of bytes in any set of files in Java - take II

Intro This post is the continuation of Get histogram of bytes in any set of files in Java. This time, I have incorporated all (?) the suggestions provided by Alexander Ivanchenko. The entire ...
coderodde's user avatar
  • 29.8k
2 votes
1 answer
162 views

Get histogram of bytes in any set of files in Java

Intro (This post has a continuation at Get histogram of bytes in any set of files in Java - take II.) This time I decided to rewrite the byte histogram counters in C++ [1][2][3] to Java. Usage is the ...
coderodde's user avatar
  • 29.8k
4 votes
2 answers
412 views

Get histogram of bytes in any set of files in C++20

Intro This post is the continuation of Get histogram of bytes in any set of files in C++14 - take II. This time, I have incorporated almost all suggestions in the answers. Code My newest trial looks ...
coderodde's user avatar
  • 29.8k
3 votes
1 answer
358 views

Get histogram of bytes in any set of files in C++14 - take II

Intro (This post is the continuation of Get histogram of bytes in any set of files in C++14.) This time I have added some ASCII art for visualizing the histogram. Also, if the program is invoked ...
coderodde's user avatar
  • 29.8k
3 votes
3 answers
889 views

Get histogram of bytes in any set of files in C++14

Intro (This post has a continuation Get histogram of bytes in any set of files in C++14 - take II.) For the sake of practice, I wrote this short program. It asks any set of file names and it produces ...
coderodde's user avatar
  • 29.8k
4 votes
1 answer
646 views

AES-256 file encryption in c#

I recently needed to write a portion of code to encrypt file to AES-256 in C# language. Since I did not find ready implementations of it, apart from string encryption, and since I'm very far from ...
Siarhei Kuchuk's user avatar
2 votes
1 answer
75 views

Determining the value of PATH_MAX on UNIX-like systems

Below is the approach taken in the function allocpath() in the book "Advanced Programming in Unix Environment", which I have modified to simply determine ...
Harith's user avatar
  • 9,777
5 votes
1 answer
127 views

Creating random music covers using Conways Game of Life algorithm

(A sample cover art follows.) I'm currently working on replacing all the covers of my music files to have a unified theme, and I've started this project in Java to refresh my knowledge after a gap of ...
Zipity's user avatar
  • 51
2 votes
2 answers
170 views

Checking file header for magic number in Python

I wrote this to check files for successful compression with LZ4. Any advice is welcome. Particularly regarding raising exceptions and error handling. ...
voices's user avatar
  • 767
6 votes
2 answers
1k views

Advent of Code 2023 day 1: Trebuchet in C (part 2)

Problem description from the Advent of Code website: Part 1: The task involves analyzing a calibration document containing lines of text. Each line represents a calibration value that needs to be ...
virtualcode's user avatar
4 votes
2 answers
386 views

Count the frequencies of each word in a file

I have tried to implement a code that does the following: store words in an array (unordered) use function order_array() to place repetitions for the same word ...
Arsenio's user avatar
  • 43
6 votes
2 answers
649 views

C- Reading and Parsing textfile

I'm relatively new to C programming and currently tackling exercises on Advent of Code. The challenge I'm working on involves calculating the sum of integers within each group from a file and ...
Noob-in-C's user avatar
0 votes
1 answer
186 views

Handling exceptions of FileInputStream and XSSFWorkbook

Can you tear my code apart with code review comments? Below is a simple method which reads an XLSX file and does some stuff with it. I use FileInputStream and ...
AutoTester999's user avatar
3 votes
1 answer
55 views

Program using java.io that shows the content of a text file and every three lines the program stop reading, waiting to press Enter

I am doing a program in Java your text using java.io that shows the content of a text file and every three lines the program stop reading, waiting to press Enter. I dont know so much about programming,...
polencr_ensayoerror's user avatar
3 votes
2 answers
185 views

Add offset to all filenames

From all the files in a directory, the method shiftFilenamesOffset is to increment the numeric part (int) of the alphanumeric filename by offset each time, and ...
Tobias Grothe's user avatar
0 votes
1 answer
51 views

Ruby-function for reading, parsing a text-file, removing data-duplicates

Task description: Implement a generate_unique_phone_numbers function. The function shall parse the given text-file. Content-example: ...
michael.zech's user avatar
  • 4,516
2 votes
1 answer
417 views

Swift-function: Copy directory recursively

Task description: Implement a function, which accepts two paths: The path to a source-directory & the path to a target-directory. The function shall return true if the directory has become copied ...
michael.zech's user avatar
  • 4,516
1 vote
3 answers
128 views

Print last lines of file

Task Write a Ruby function, which accepts a path to a text file and returns a string consisting of the last n lines in reversed order, separated by commas. Example input file: ...
michael.zech's user avatar
  • 4,516
9 votes
5 answers
1k views

Find out all the different files from two different paths efficiently in Windows (with Python)

Well, recently I'm working on a program which is able to sync files between different folders. However, as a fresh man, the algorithm I worte seems feasible, but looks really disgusting, and ...
Robert He's user avatar
2 votes
2 answers
187 views

Increasing writing speed to file inside a for-loop for large files

I have a .csv file containing 100 millions records, I would to create multiple files from this file, after certain condition satisfied in each line, I came to this code below, but it is slow, I think, ...
Khaled's user avatar
  • 309
1 vote
1 answer
363 views

Replacing NOUNS, VERBS, ADJECTIVES in a text file with input words

I've written code for a program that reads a text file, checking if there's any capitalized parts of speech of specific types (noun, adj, verb, adv) in the text and replace them with the user's chosen ...
Nova's user avatar
  • 113
6 votes
2 answers
234 views

ds - A directory switcher via tags in Windows command line

I have this repository. The idea is that there is a file tags sitting in the users home directory, and which contains the tag declarations of the format ...
coderodde's user avatar
  • 29.8k
4 votes
1 answer
148 views

System Utility to Create Random Files

The following program makes random files. By default, they are of the form /tmp/rfile-XXX. Certain options allow for the user to specify where these files are ...
Jordan's user avatar
  • 79
1 vote
2 answers
64 views

Checking which programs are used for scripting

I have a directory where there are some script files, some binary files, and some subdirectories. I have tried to write a program which gets names of all files in directory, and excludes if they are ...
rnso's user avatar
  • 273
7 votes
2 answers
496 views

Copy file with text replacement

I am currently learning C++. I coded a tiny program for school and I wonder if there could be issues (like bugs or security issues) with it. Any ways to make it have weird behaviours would be very ...
BobDeTunis's user avatar
4 votes
1 answer
147 views

Implement Seek on /dev/stdin file descriptor in Rust

Problem: In order to be able to use the arrow crate's infer_file_schema function with input piped to ...
Cornelius Roemer's user avatar
1 vote
2 answers
1k views

Geting file-names from the current working directory

The following routine returns the file-names from the current working directory: ...
user366312's user avatar
1 vote
1 answer
256 views

Delete files with specific filename pattern in directory with all extension using python

Preamble The first following code explains the context. ...
simone100's user avatar
  • 111
3 votes
1 answer
582 views

SImple Inverted Index

This is a simple inverted index I made. The goal is to: Read set of text files from a directory, docs Tokenize them Normalize the tokens by removing punctuation ...
iluvfugu's user avatar
-2 votes
1 answer
401 views

Number Plate Generation Program

I wrote a number plate generation program. The program generates number plates for a car registered with a specific Memory Tag and on a specific date. Number plates use the following format: (2 letter ...
kmvfkmfv's user avatar
4 votes
2 answers
1k views

Logger that writes to text file with std::vformat

This class has a Log function that appends text to a log text file. It takes a format string and a variable amount of arguments, much like a ...
vince.smdt's user avatar
1 vote
3 answers
82 views

FileIO lines to String Converter

I think I made a good FileIO object because I can simply copy-paste whenever I need, however I wonder How I can improve my code. This code takes file path of the target file and turns every line to ...
ekan123's user avatar
  • 13
-3 votes
1 answer
199 views

Opening a directory as a file descriptor creating it if it does not exist [closed]

Variables: conf of type struct Conf whose details are not relevant to this review stores the configuration data being read. <...
user avatar
4 votes
2 answers
145 views

A simple and fast library/code to store & manage variable data

I've been searching through the different ways to store data and found some helpful and actually great libs like: JSON XML And some neh: text file basic write and read some binary type data storing?...
user avatar
7 votes
1 answer
207 views

Command-line correlation calculator in Java

I have this Java program that asks for a name of the file containing data rows in the format $$ x_1\ y_1 \\ x_2\ y_2 \\ \vdots \\ x_n\ y_n $$, and outputs on the command line the Pearson correlation ...
coderodde's user avatar
  • 29.8k
2 votes
1 answer
498 views

Sending and receiving files in C win32 using a socket

I have a piece of code to send and receive files on Windows with C. Is this the right way to do it? And am I guaranteed that the full file will be sent and received? Receiving function: ...
Y K's user avatar
  • 83
3 votes
1 answer
76 views

Python Function that Replicates a Directory's File-Tree for Specific File Types while Changing the Parent Directory

Problem Context: I needed to make a script that would search through all the files in a GitHub Repo and find all the README files within it, then replicate the File-Tree of the Repo to a specified ...
Prithvi Boinpally's user avatar
0 votes
1 answer
87 views

duplicate an open file descriptor [closed]

My program implements a function similar to `dup2'. I would like you to please find any problems with the code and what I could improve. code: ...
Mirel Vlaseanu's user avatar
1 vote
1 answer
294 views

File Abstraction Library

This library is a layer of abstraction over file operations in C#. It aims to provide easy file IO syntax, and implicit error handling behaviors, to ensure robustness in scenarios including, but not ...
Divan's user avatar
  • 113
2 votes
0 answers
87 views

Simple diff utility in Java using OOP take 2

(See the previous iteration here.) After further revising my code, I have: com.github.coderodde.diff.Diff.java: ...
coderodde's user avatar
  • 29.8k
2 votes
1 answer
131 views

Simple diff utility in Java using OOP

(Previous and initial iteration lives here.) (The next iteration is here.) Now I was able to spare some lines by putting diff related state in an object. Also, I relied on ...
coderodde's user avatar
  • 29.8k
6 votes
2 answers
994 views

Simple diff utility in Java

(See the next and second iteration here.) I have this toy implementation of the diff utility in Java: ...
coderodde's user avatar
  • 29.8k
1 vote
1 answer
194 views

Open a file, with a fallback path if it doesn't exist at one location

I am parsing a file that exists in either app/components/ui or in app/components. If the one in the first dir (...
jeffci's user avatar
  • 248
1 vote
1 answer
354 views

File dump in assembly

This is a file dump program written in assembly that displays 320 bytes at a time in 20 lines. It shows the hex code for each character and also the string At the start of the program it asks for the ...
user259137's user avatar
1 vote
1 answer
865 views

Adding string to a text file without duplicates

I have a function below, store_in_matchid_file, and it adds certain strings to a .txt file as long as that string doesn't already exist in the file. However that ...
Jack's user avatar
  • 47
2 votes
2 answers
5k views

touch command in C

I wrote a program in C that simulates the touch command from linux. I would like to ask you to criticize my implementation, to find bugs in particular ...
Mark's user avatar
  • 449
2 votes
2 answers
222 views

No Reference Image Quality Assessment for Video in Matlab

I am trying to perform the No-Reference Image Quality Assessment (NR-IQA) calculation on video. Several NR-IQA methods including Naturalness Image Quality Evaluator (NIQE), Perception based Image ...
JimmyHu's user avatar
  • 5,510
1 vote
1 answer
88 views

Unit tests for PNGme steganography exercise in Rust

I want to become proficient in Rust and I've followed the PNGme exercise. I've completed it up until Chapter 4 included, where I've written a lot of tests myself for verifying that the command line ...
rdxdkr's user avatar
  • 111

1
2 3 4 5
17