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
1 vote
0 answers
39 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,442
5 votes
1 answer
121 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
132 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
370 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
647 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
159 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
52 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
184 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
47 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,358
2 votes
1 answer
366 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,358
1 vote
3 answers
122 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,358
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
186 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
350 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
231 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
  • 28.9k
4 votes
1 answer
142 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
0 votes
2 answers
61 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
  • 241
7 votes
2 answers
488 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
143 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
249 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
3 votes
1 answer
574 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
392 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
79 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
191 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
144 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
  • 28.9k
2 votes
1 answer
480 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
73 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
289 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
85 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
  • 28.9k
2 votes
1 answer
128 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
  • 28.9k
6 votes
2 answers
992 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
  • 28.9k
1 vote
1 answer
191 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
347 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
857 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
217 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,360
1 vote
1 answer
86 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 vote
1 answer
188 views

Passwords with C++ Console

I am really, really new to coding in general and especially c++. To get more familiar with c++ I am trying to do a series of projects with c++ console apps. One of my projects is with a database that ...
Jack Parent's user avatar
3 votes
3 answers
179 views

tee: copy standard input to both stdout and a file

I implemented the tee command from linux. The program also handles the -a option for adding text to the end of a file if it ...
Mike's user avatar
  • 299
1 vote
0 answers
79 views

Creating a reusable DictWriter context manager

I want to simplify the repetitive work of creating a DictWriter in a with context manager. So I created a ...
supermitch's user avatar
3 votes
1 answer
159 views

Processing a binary file with buffer length tags

I am trying to process a very large binary file using MappedByteBuffer from java.nio package. This is how the data looks like in the file: ...
SuhasG's user avatar
  • 33
2 votes
1 answer
136 views

Image file uploader webpage in HTML5 and PHP

I am trying to make a webpage for uploading an image file and storing the uploaded file on server. There are several features in this implementation: There is a drag & drop zone on the webpage. ...
JimmyHu's user avatar
  • 5,360
0 votes
1 answer
69 views

PowerShell to query SQL database with a string from a filename

I am trying to write a PowerShell script that will check a folder for any files and then for every file it will grab part of the filename and check it against the SQL database. If it found a match, it ...
Rudixx's user avatar
  • 1
6 votes
2 answers
1k views

Read and write triangulated surfaces

Recently, I wrote a class which can load an .obj file into vector array, and save the vector array as an .obj file. The .obj file looks something like this: ...
jack tsang's user avatar
7 votes
5 answers
2k views

Robust program to write an array of certain data type to a binary file and read back from it (C++17)

Problem description As the title indicates, I want to be able to write to and read from a binary file safely, in the sense that I want to have full control of everything that might go wrong. Since I ...
AngelosFr's user avatar

1
2 3 4 5
17