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
5
votes
0answers
46 views

Comparing same-size files and reporting on the differences byte-by-byte

I created a small Python utility to analyze multiple same-size files and report on the difference byte-by-byte (i.e. Hamming distance, not Levenshtein distance.) I am planning to extend the ...
4
votes
2answers
62 views

Escaped line reader

The idiomatic way of reading lines from a file doesn't work for my purposes because the files I'm dealing with might have lines that are escaped. I came up with the below (which seems to meet my needs)...
4
votes
1answer
57 views

Minimalist config file reader/writer

I have written a simple configuration file reader and writer in D that is intended to parse string[string] associative arrays (the whole file is one array) and ...
4
votes
2answers
80 views

Importing files into Excel

Any tips to reduce lines, improve speed, or any cool thing, are welcome. I have been using this for years and I just realized, why not improve ...? ...
2
votes
2answers
79 views

Random binary digit generation and file I/O

I've recently made a program which generates a (pseudo) random binary digit (1,0) which is tied to a specific subject to learn for every day of the week. The program generates the digits the first ...
7
votes
3answers
263 views

Convert binary raster file to text CSV

I have a binary file input.hgt from the Shuttle Radar Topography Mission. It contains a 3601✕3601 matrix, stored as 2-Byte big-endian integer numbers. My code ...
2
votes
0answers
56 views

Reversing a file in Fortran

This is my first foray into (modern) Fortran in order to learn a bit more about the language, and I'm attempting the following problem: taking the path of an arbitrarily-sized text or binary file ...
5
votes
2answers
73 views

Producing excerpts from a file at specified positions within long lines (>1 M characters)

I'm trying to read a file containing over 10.000 lines and each line contains an ID for an individual and a very long string composed of more than 1 million characters (numbers as example: ...
2
votes
1answer
366 views

B-Tree implementation in secondary-memory/disk-memory

I will start by saying this implementation was based on the approach taken with B-Trees in the book: Introduction to Algorithms, 3rd Edition - Cormen, 2011 The implementation stores all the b-tree ...
1
vote
2answers
49 views

Method that reads an input file of a particular format and creates objects corresponding to the file

This is essentially a best practices question about reading a file and making sure it follows a specific format. My current implementation works, but it's a while ...
5
votes
2answers
213 views

Implementation of the `tac` command

As a C programming exercise, I implemented a minimal tac program that prints the input line by line starting from the last line. I'm looking for feedback on my ...
2
votes
1answer
96 views

Convenience function for writing files in CSV, JSON, etc

The McCabe code complexity of the following function is 19 as found by pytest --mccabe test.py (from my toy-project mpu). While ...
7
votes
3answers
180 views

Console based Vocabulary Trainer

This code was reworked and repostet in Console based Vocabulary Trainer Version 2 I wrote a console based Vocabulary Trainer to practice C++. Its possible to add and remove vocabulary and practice ...
5
votes
1answer
373 views

File uploads in Laravel - Single and multiple

I have been reading up on file uploads in Laravel, reading through the documentation and looking at best practices. In my application, I have two instances: an upload area for single files, and an ...
2
votes
1answer
37 views

Creating lstlistings for Java files in multiple Java folders

I did write it to have a solution for my problem. But I don't know if my code is ok. Can you please check it? Problem: I want to include all my Java files from all my projects (created with Netbeans)...
4
votes
1answer
159 views

Word counter for text files

I've made a program that works, but i want to make it reusable. This code reads in a dictionary object created in another class (that i made), as well as read in a text file to put in said dictionary ...
6
votes
1answer
47 views

Reformatting Latin vocabulary sets from The Bridge

I am currently studying Latin from Wheelock's Latin. Given that a core component of language learning is memorizing vocabulary I needed somewhere I could memorize vocabulary, online, namely Quizlet (...
3
votes
2answers
71 views

Find most frequent word in text file

Write a function that a receives file name of a txt file, which contains unknown number of words of max length 10 each. Print ...
4
votes
4answers
144 views

Printing a file

The goal of this function is to print the contents of a file. Pretty much what the simple invocation of cat does. Since C is famously hard, I am looking forward to your comments. ...
5
votes
2answers
97 views

Read a file with transactions and sum all the revenue for each product ISBN

I am trying to improve the algorithms for the following code! The problem I am trying to solve is that I have nested loops that don't look efficient. This includes the Sales_item.h file from C++ ...
4
votes
2answers
66 views

My own functions for working with files

I wrote the functions for opening a file, getting a file size and getting a file contents. I would welcome any suggestions to improve my code. You might think I'm over-commenting the code. But I do ...
13
votes
2answers
13k views

Read and write BMP file in C

I'm teaching myself a little C, and I've found this website. It has an exercise about manipulating a BMP file in C. I would like to know if I can make my code look more "idiomatic" or professional, ...
-3
votes
1answer
157 views

C++ program involving reading and displaying information from a file? [closed]

This is a program I made for practice in file handling in C++. The purpose of the program is to write three nos 1 2 and 3 into a file abc.dat and then read it and display it on the monitor. When I ...
6
votes
2answers
342 views

Program for swimmers to evaluate their training

This is a program that would allow the users to evaluate themselves on a swimming training, it saves the evaluation in a new text file with the date as a title. There are many repeated blocks of code ...
2
votes
1answer
62 views

Function that reads big files in C

I made a function that writes all the data from a hashtable to a .txt file and another to read the said data. The data comes from a this type of struct and it should be read into it when called <...
2
votes
1answer
117 views

Analog of unix word count (wc) in Java

I wrote implementation of unix console program word count "wc" in Java. Please evaluate it. Is there any better solution? ...
4
votes
2answers
822 views

Caesar cipher encryption

I've been studying C++ (my first language) for about two months with books and Udemy courses. I would like some comments about my first real project that I put together for my teacher. ...
10
votes
2answers
5k views

Writing a bitmap image from C++

Here's my function that creates a bitmap file from an array of pixels. It can write a bitmap both with transparency and without transparency. Please review my code and give constructive criticism on ...
8
votes
3answers
3k views

File encryption with password

I would like to have my C# cryptography code reviewed. I programmed an application that encrypts files with a password (provided by the user). It basically functions as a password manager, on the ...
-8
votes
1answer
718 views

Java program to disturb user and waste SSD lifetime [closed]

This Program has three goals: Disturbing the user that accidentally run this by opening a lot of windows Creating a lot of files that waste the lifetime of SSD's Destroying Overview and waste time - ...
5
votes
2answers
909 views

Convert JSON from a webservice to text file

I get list JSON text from a webservice and list_of_columns is predefined, I need the output in that format. I am not sure about few things which are as follows I ...
0
votes
1answer
342 views

Read Local File

I'm trying to read any file locally and write out the binary as string, it loads and reads small files very fast. How can I modifier it to read large files greater than 1gb without crashing the ...
9
votes
1answer
2k views

Markov chains to generate text

This is my Python 3 code to generate text using a Markov chain. The chain first randomly selects a word from a text file. Out of all the occurrences of that word in the text file, the program finds ...
4
votes
2answers
67 views

Using BufferedReader to read lines of a file into a list

To help improve my proficiency with Java, I would like to know how should I close these FileReaders as I have come across multiple answers, and what could I do better with this block of code? ...
5
votes
4answers
628 views

Arrange lines of a text file

This program orders the lines of a text file alphabetically and prints them out to a new text file. Usage: java Arranger input.txt output.txt Is this the best ...
8
votes
1answer
90 views

Implementing a File class

I studying for a Python course. I was finished working on task about creating a file class which can read, write lines to file. This class also needs magic methods (...
5
votes
2answers
310 views

Uploading multiple files to server with PHP and JavaScript

I wrote some code to upload multiple files to a server with PHP and JavaScript. I'm happy with the form and JavaScript, below. ...
1
vote
1answer
100 views

File manipulation with Haskell

I am trying to pick up Haskell! But I feel like my code is a bit painful to write and read. Do you have any pointers on how to improve its readability / style? ...
3
votes
2answers
2k views

AES File Encryption / Decription VB.NET

I've been looking for a while for the right code to encrypt/decrypt files with AES in vb.net. I created the code below. Is this the right way doing AES encryption/decryption nowadays? ...
3
votes
1answer
254 views

Using generator for buffered read of large file in Python

I have a large file that I need to parse - and since it will be regenerated from external queries every time script runs so there is no way to parse it once and cache the results. I want to save ...
3
votes
2answers
892 views

Efficiently read in 2nd column of CSV into List of Lists in Python 3

I created a function to read in arbitrary numbers of .csv files, their 2nd column only, into a list of lists (or if there is a more efficient data structure, then that). I want it to be efficient and ...
2
votes
3answers
1k views

Gradebook program that tracks the performance of the students in the class, displays the students with highest and lowest grades

This program contains two classes, Student and Course, that will allow the user to analyze the performance of students in a ...
5
votes
2answers
66 views

Merging two files' lines of text for output

My program is supposed to merge two text files' lines together. For instance, if I have two files, one.txt: ...
0
votes
0answers
44 views

Optimize the file content comparison

Program to compare if files within two directories are having same content I followed the approach of getting the list of files under two directories recursively and store it in different list with ...
4
votes
2answers
233 views

Reading vertex data from a file

I have a function that reads numbers from a file and constructs a Vector3. Can anyone think of how I can make improvements to this since I am new to C++? The file ...
11
votes
5answers
2k views

Counting relevant entries in a large bioinformatics file

I have a working example of a piece of code which opens up a file, gathers information about the contents, and outputs a map which contains the information. The file The file type is an in-house ...
2
votes
0answers
91 views

TI-Basic file manager

Tested on my TI-84 Plus CE. Variables: F: Stores the file listing's ID N: Stores the current file's ID ...
2
votes
1answer
117 views

Counting different kinds of line terminator characters in files

Can someone take a look if this code piece is ok. I'm most interested whether the goroutines are used correctly, but also general Go best practices. ...
2
votes
2answers
1k views

Word counter using a word list and some text files

My program works with two types of files. File 1 contains 500,000 distinct words. File set 2 contains 173 text files, each containing 500 paragraphs, that I scraped from Wikipedia. The program ...
3
votes
1answer
516 views

Script to store, search, and delete IPFS data with description in JSON file

Here is the script that I would like reviewed for the following: Best practices and design pattern usage Correctness in unanticipated cases Better dictionary access The script is made to store (IPFS)...