Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

3
votes
1answer
24 views

Pulling images from Windows 10 Lock Screen to a different folder

Windows 10 has an interesting feature where it will display "fun facts" and images on the lock screen. Occasionally, these images are something I would want to use for a background. These images are ...
4
votes
1answer
33 views

Processing file inclusion directives using mutual recursion

I am preprocessing a set of files where one file is included in another file with an include tag like shown below: file A ...
3
votes
0answers
25 views

Simple one-time pad in Rust

I am new to rust and to start learning the language I decided to implement a simple one-time pad encryption program. The part I am least sure about is the reading and writing from the files. Ideally ...
3
votes
0answers
31 views

Parsing version from Cargo.toml

I want to get version from Cargo.toml and use the value inside my app. Here is a function I wrote: ...
5
votes
1answer
64 views

Two cross-platform implementations of getline in C

I created my cross-platform implementations of getline function in C. It takes different arguments and have different return values than 'original' ...
6
votes
1answer
56 views

Linux cat command in C

I wrote my own implementation of the linux cat command in C for my computer laboratory class. We were asked to replicate its functionality with no options passed as arguments or with just the -b, -n ...
9
votes
2answers
611 views

Read/write a pipe-delimited file line by line with some simple text manipulation

This code that I wrote is supposed to read/write a pipe-delimited file line by line to a new file with some simple text manipulation. (It also adds two new columns) and publishes a "Status Update" ...
-3
votes
1answer
55 views

Code creates huge Text File [closed]

A Java program that writes each digit on a new line, from 1 to max integer. We should end up with 2.4 Billion lines. After looping to near the maximum integer, the text file becomes really huge. Like ...
2
votes
0answers
25 views

Sharing File (Content) without saving it before

I have a listview of PrivateFile objects which contain the fileId (int), fileName (String) ...
3
votes
1answer
77 views

Reading all file contents via x64 assembly

I have come up with the following snippet by building upon the answers given to my StackOverflow question. Just trying to get some other eyeballs to review things so that they can point out any ...
5
votes
1answer
62 views

Sorting words by frequency

I'm doing a simple task in Rust after reading the Rust book: read a text file split it at whitespace sanitize words by removing non-letter characters sort the words by their frequency of occurrence ...
7
votes
2answers
93 views

Multi-Line text reader

I am attempting to teach myself C++ by writing a simple multi-line text reader that reports the lengths of each line. What can I do better now that I have something that "works?" Conventions: ...
3
votes
1answer
43 views

Find a valid english phrase that is identical to what the user entered, save a missing consonant

The Task: The user enters a path to a dictionary file (one word per line) and a phrase as system arguments. My code must then find phrases containing only valid English words, generated by removing ...
5
votes
3answers
97 views

My own getline function for reading strings from files

I am a newbie to C++ and I want to do some cool stuff with it. Here I have implemented my own getline function which reads from a file. so what do you think of this getline function? ...
4
votes
4answers
115 views

Simple command-line XOR encryptor/decryptor for files

I just made this simple XOR encryptor and decryptor. It needs a file with the "private" key string inside. usage: encryptor "file to encrypt/decrypt" "file with the private key" "output file" To ...
2
votes
1answer
40 views

Python code to get all lines between two keyword lines in a file (with exceptions)

I have coded multiple variations on this and would like to make it generic, to avoid coding any more variations. Comments and suggested improvements, please, (typos also), and what about that ToDo ? ...
2
votes
1answer
43 views

Concatenating an already existing filename to create a new file

I had answered this question from stackoverlow and the code below is code that I wrote to explain to the OP a possible way to achieve what I believe they were looking for. The general idea that I ...
10
votes
5answers
2k views

Basic C copy file implementation

I'm a java programmer by trade and starting to learn C/C++. I'd appreciate any pointers on glaring issues with my code style which is acceptable in java but not in C. I feel like open_files is ...
2
votes
1answer
58 views

Locate substrings within a file

Here, I am reading in a newline delimited file that can be millions of repeating lines that looks like this: ...
3
votes
2answers
172 views

Write output file, collating groups of up to 7 input lines

I have this code that reads a file and after processing a few lines writes the output to a second file: ...
3
votes
2answers
41 views

Implementation of getdelim

Note: I wasn't trying to follow the POSIX getdelim signature exactly. I needed to add the consume argument for a project I'm ...
2
votes
1answer
65 views

Finding the longest word without these characters follow-up

Here I asked this question: My goal is to go through the list of all English words (separated by '\n' characters) and find the longest word which doesn't have ...
2
votes
1answer
62 views

Looping through file finding sequences

For an assignment, I had to loop through a text file, and report any positions that a user entered sequence was found. Is there any way I can make this code more efficient, because it seems like I'm ...
3
votes
3answers
195 views

Count characters of a text file

This program counts the number of the occurence of each character that is used in a file. I tried to use everything that Java offers to me properly. If you have tips which library functions would ...
1
vote
2answers
57 views

Reading new data from a constantly updating file in Java

I have a log file which is constantly updated with new lines of data. I need to get new added data in java as soon as it's written. For now my solution is: ...
1
vote
2answers
122 views

Write byte array to end of file

I'm writing a byte array at the end of file. The code works fine, but can you please suggest performance improvements? ...
5
votes
2answers
113 views

Invert rows and columns in an Excel file

Annother little excercise with openpyxl: Say you have a Excel file like this: The Goal is to make make it look like this: My code to acomplish this: inversion.py ...
2
votes
1answer
35 views

Excel blank row inserter

I wrote a program as an excercise, to check the openpyxl module, which inserts blank rows into an excel file. See the docstring in the code for more description. I ...
0
votes
1answer
123 views

Java splitting too large text file enhance performance

I have a too large data.txt file containing data as follows: ...
2
votes
0answers
35 views

vb.net Create textfile from template

What is the best approach for creating textfiles from/with a template ? Currently I just read the template from a textfile and Replace all values needed, but I don't think that this is the most solid ...
5
votes
1answer
47 views

Find big files on the harddrive

For practicing Python I wrote a script which scans the harddrive for large files and lists them in a report. The script takes the root path and then all the subfolders are scanned aswell. Also the ...
1
vote
0answers
25 views

“Function” to extract a file in Batch

Recently, I've been doing more and more Batch "programming". I always find myself in the need to extract a file and do something with the files. This is not my first version, and a few non-general-...
2
votes
1answer
277 views

Mad Libs excercise

I did the following Excercise from Automate the boring stuff with Python Chapter 8: Create a Mad Libs program that reads in text files and lets the user add their own text anywhere the word ...
6
votes
2answers
319 views

Text Duplicate filter in Python 3.7

I wrote this program just to remove duplicates from wordlist used for brute-force, but it can be used for every txt file i guess. It is a pretty long program for what it does, and I'm sure there is a ...
1
vote
0answers
19 views

Encapsulating simple license backup to a disk

I am enapsulating my license backup to disk, using an interface ILicenseProvider and the implementation is DiskLicenseProvider. Also i am throwing an unchecked exception LicenseProviderException which ...
6
votes
2answers
142 views

Minimalistic, self-contained class for reading a sectionless INI file

When sections are ignored and no writing capability is needed, an INI reader becomes quite simple to implement. Here is my attempt at reading a sectionless INI file without any non-...
2
votes
1answer
51 views

Unit tests for directory-entry counter

I have a function that simply counts the number of files in a directory. To test this function I am using temporary files which are great in the respect that they are deleted upon creating. However, ...
2
votes
1answer
42 views

Count features in a file, using parallel code

When processing large files (say for parsing or performing computations based on the contents), we want to be able to use multiple processes to perform the job faster. In my case I wanted to count ...
5
votes
1answer
70 views

Small program to get binary diff offset between two small files

Trivial utility program meant to go through the list of (small) files and report file offset of the first difference between them. The goal of the code is simplicity. Any recommendations are useful. ...
9
votes
4answers
1k views

Program that finds the longest word not containing one of the disallowed characters

Problem definition Find the longest word that doesn't contain any of the following characters: gkmqvwxz Input comes from a file named ...
4
votes
1answer
51 views

Making a Zsync file archive with checksums

I'm learning go by doing it. I tried to port the Java's ZsyncMake implementation into Golang. I also employ the Go's concurrency API with goroutine and channel. I have some experience in Java, but ...
4
votes
2answers
159 views

Detect file type using file signatures

My program has to detect the real file type of a given file using signatures. For now I'm just checking JPG, but I want to add more. ...
9
votes
4answers
3k views

Comparing two large binary files in C

I'm trying to read two sufficiently large binary files, comparing them and printing the offset at which they differ. I'm using fread to read the binary files and <...
0
votes
1answer
32 views

Process CSV files that follow the first nonempty one

I have a list of CSV files (all have the same fields), some of which are empty. My goal is to find the first nonempty file and use that as the "base" file for an aggregation. After finding the base ...
6
votes
2answers
531 views

Copy certain lines from one text file to another

I need to open a file, read a line and if that line respect some conditions write it to another file, the line that I'm reading is a normal ASCII string representig HEX values and I need to paste it ...
3
votes
1answer
77 views
7
votes
1answer
173 views

View, append, write, or delete a file

I am just wondering if I need to refactor this code into smaller functions, or if it is OK as it is. I know that code should be as clean as possible, but I don't see a need to declare a new function ...
2
votes
1answer
38 views

ProcessPoolExecutor KMZ file search

I've written a script to look for coordinates in KMZ files. I've tried to speed execution up using the ProcessPoolExecutor. I'm quite new to Python, so any recommendations are more than welcome. <...
2
votes
1answer
62 views

Read a directory of CSV files in R

I'm writing a lot of R in my spare time and am trying to get into good habits by using TidyVerse as much as possible. A large part of this has required reading entire directories of dated log files ...
4
votes
3answers
372 views

Library Management using File Handling

I have never written program in file handling. Help me improve this program. book.h ...