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.

learn more… | top users | synonyms

-1
votes
0answers
19 views

How to Make Words random in C? [closed]

Suppose i have word apple in variable b like this char b[100]; b[]={a,p,p,l,e} How can i generate random string like this: ...
4
votes
3answers
75 views

Counts the number of times a particular character, such as e, appears in a file

This question came from a Java tutorial online: Write an example that counts the number of times a particular character, such as e, appears in a file. I was just wondering if there is any way to ...
8
votes
4answers
106 views

Python Implementation - Conway's Game of Life

This is my implementation of Conway's Game of Life in Python. Now since I am a novice coder, naturally I have some key doubts: The usage of idioms and code redundancies - Are there any small ...
3
votes
2answers
55 views

BMP file writer

In my current project I'm writing a C function to write a BMP-File. Internally, the function is split up into three parts: write header, write info header, write data. In some of these functions I do ...
3
votes
3answers
58 views

Creating and manipulating FITS files

I wrote a program that manipulated data from VLA observations and created FITS files to be used in creating spectral energy distributions of high redshift radio galaxies. I really tried to be as ...
3
votes
4answers
376 views

Min and max of numbers read from a file

I had to create this program, and I did it fine, all is working and stuff but I was wondering, what is better way of doing such thing? I want more efficient method. Problem assignment: In the ...
8
votes
2answers
780 views

Q&A-based file editor

As part of my autodidacticism into all things Python related, I have decided to write a number of functions that I can save in a library for future use. One such function that struck me as useful to ...
3
votes
3answers
67 views

Command called 'sprinkle'

I have a command called sprinkle. I'm not going to explain anything about it, because I want whoever that reviews the code to also tell me how much of the command ...
6
votes
3answers
215 views

Loading tab-separated tweet data into an array

I'm working on this school project and was wondering if there was any way of storing this information better, faster, more professionally. I'm also restricted to only using an array; don't ask me we ...
2
votes
1answer
55 views

Creation of playlist to fake-split a full-album video

I created this snippet to "split" my full-album videos into its individual songs without the need of actually splitting the video file. I personally created this snippet because I enjoy reading all ...
-1
votes
0answers
32 views

Given a path to a directory, print the path to the biggest file in it - revision 2

The problem description is in the title. Revision 1 I followed the suggestions from this answer. In this revision: if (files != null) is used instead of ...
4
votes
2answers
80 views

Search word in multiple files

I am writing a brute-force method to search for a word. Please review my code and tell me how I can improve it. ...
2
votes
2answers
61 views

Counting the occurrences of a string in each file

I am trying to find a phrase or a string in file and count the number of occurrences of that string: ...
4
votes
2answers
103 views

Given a path to a directory, print the path to the biggest file in it

Here is my code. I simulated a stack rather than used some regular recursive algorithm because I needed to keep track of two variables: the path to the biggest file and its size. Besides I wrote a few ...
1
vote
0answers
21 views

Unlock spreadsheet files - follow up 2

Awhile ago I created a program that unlocked spreadsheets, for a better understanding of what happens when it's run, see here. I decided to rewrite it again, and go for a more OOP approach.. My ...
3
votes
1answer
91 views

Writing data to a file

I have the following two methods that write to file various data line by line. Both methods differ from each other only by few lines what would be the best way to refactor them that when in future I ...
6
votes
0answers
126 views

Extracting single files from a tarball (spreadsheets)

I've created a program that will pull spreadsheets out of a large tarball. First it specifies the file name through the "folio" number which is given as an argument when the program is called. From ...
1
vote
2answers
65 views

Efficiently process large (~100MB) structured binary file in C

This question regards the C implementation of the python code posted in this other question of mine, hence the explanation of the task at hand will be the same: The problem I need to process the ...
3
votes
1answer
61 views

Ordering a .txt file numerically by size and alphabetically

I am doing a controlled assessment and one of the tasks is that we have to sort the saved pupils scores (numerically), and their names (alphabetically) in a .txt file. Any other improvements to the ...
5
votes
1answer
53 views

Read through a log file to find “Fail” lines

Please bear with me, I'm only about a week into Python. This code is something that I wanted to do once I completed the chapters dealing with opening and reading files, and RegEx. I always feel like ...
4
votes
2answers
91 views

Efficiently processing large (~100 MB) structured binary data in Python 3

I need to process the data contained in a (relatively) large binary file. The file has the following structure: ...
8
votes
4answers
903 views

Creating a unique file name in C#

I find that I am often writing files where the names either: Need to be incremented (rather than overwriting a file that already exists in the directory with the same name) Need to be timestamped ...
2
votes
1answer
32 views

Using GetTempFileName api function to check write access to a directory

On windows, to find out if I have write access to a directory, I found that it is easiest to just create a file in that directory. In order to do so, I found ...
4
votes
1answer
57 views

Search file for keyword program

Just looking for some advice and I know using std namespace is bad but I didnt have the time to do all the using stuff. I want help on what here is good and what is bad practice :). ...
2
votes
2answers
52 views

Resolving IP to hostname in Python 2

This piece of script will take one argument (file which contain list of ip, one per line) and convert it to its hostname. For now this will only work with IPv4. This definitely doesn't look good and ...
5
votes
1answer
51 views

String parsing and saving ipaddress to file in Java

Following function will parse string resp, which will be like shown in following example. I will get an IP address in the form of a hexadecimal string like ...
6
votes
1answer
52 views

Dealing with a command line argument (path) with spaces

I created a key in Windows registry to have an option on every folder which allows me to simply right click, choose the right option and have a PDF made, either from JPGS, or PNGs, or TIFs. My ...
7
votes
2answers
66 views

Updating resources while avoiding race conditions

I am writing a utility class for a game client. This class has two main functions: connect to a game server and retrieve the current game revision, and retrieve a "recipe", which is basically ...
6
votes
2answers
137 views

Frequency count of single words and word pairs over 20 million tweets

My application needs to read 20-million-line text files and count the word frequencies for one and two words. For example: A B A B SSS G D A One word Frequency A: 3 B: 2 SSS: 1 G: 1 Two ...
7
votes
2answers
118 views

Usage of scanner

I have a legacy method which I would like to clean up: ...
6
votes
2answers
58 views

pjen - Simple static website generator

I've created a simple static website generator called pjen. The GitHub repository can be found here. ...
6
votes
2answers
131 views

Random File Opener

I wrote a random file opener in Python that takes file extensions as a tuple at code level, and directory/amount at console level: ...
7
votes
5answers
651 views

XOR encryption program in C

I've written a program that encrypts files (or stdin) with a user-specified key from 1 to 255. This "encryption" is very insecure, but still a bit better than ROT13 ...
0
votes
2answers
35 views

Differences in word counts in two files

How can I change my two functions to be more readable functions (i.e. in steps), because I am using pycharm. ...
11
votes
4answers
126 views

Let's play Find that File

Isn't it annoying when you can't find a file you recently created? Especially when you either have a very disorganized drive or a directory with lots of files. Even if you don't care, isn't it nice ...
3
votes
1answer
70 views

Scanning multiple huge files in Python (follow-up)

I'm trying to implement an algorithm able to search for multiple keys through ten huge files in Python (16 million of rows each one). I've got a sorted file with 62 million of keys, and I'm trying to ...
9
votes
1answer
415 views

Scanning multiple huge files in Python

I'm trying to implement an algorithm able to search for multiple keys through ten huge files in Python (16 million of rows each one). I've got a sorted file with 62 million of keys, and I'm trying to ...
3
votes
1answer
65 views

Non-curses pager in C (revision 2)

In this revision (follow-up of this post) I've fixed reading from stdin, and also tried to minimise the damage caused by typing additional characters. You might want to see my original post on this. ...
8
votes
1answer
359 views

Non-curses pager in C

I have written a pager in C that is supposed to be used in systems where curses is not installed (or broken). It can also be used as a system-wide pager, it works ...
3
votes
3answers
249 views

Reading and printing a text file in Java

I am trying to read lines from a text file in Java, but there is a lot going on. Is this the best way to do this? I am especially concerned with resource leaks. ...
1
vote
2answers
100 views

Calculating the energy of a signal

I have a program to read signal data from 120 files in a folder and performing the energy of the signal. It works correctly, but execution time is more than 20 mins, so there may be a problem with ...
6
votes
5answers
824 views

Memory-safe file-reading in C

I am trying to write a single function that will read a certain number of bytes from a C file, or the entire file, based on the arguments. I want it to be memory-safe of course, and deal with ...
2
votes
3answers
82 views

File parsing and data management - follow-up

This is part of a two-part post (Part 1). Here, I have two recent projects that parse a file. The first uses a loop that's kind of hard to follow, and the second uses "modes" to decide what to do. ...
3
votes
1answer
34 views

File parsing and data management

This is part of a two-part post (Part 2). Here, I have two recent projects that parse a file. The first uses a loop that's kind of hard to follow, and the second uses "modes" to decide what to do. ...
0
votes
1answer
41 views

Unlocking spreadsheet files quickly - follow-up

I recently posted a program I made to unlock spreadsheet files( see also ), I've taken all of your advice and made it more Ruby like, it has no shell commands in it, and uses ...
1
vote
2answers
118 views

Java Utility that converts warc (Web Archive) files into XML files

I have written a program to perform a task, but I'm guessing it is not optimized. I want to know if there are any ways to improve the effiency and performance of this program. This program reads a ...
4
votes
1answer
62 views

Unlocking spreadsheet files quickly

I've created a program for my job that unlocks spreadsheet files quickly and efficiently. What we use to have to do before this program is we'd have to go into the system, search for the file, kill ...
4
votes
1answer
41 views

Powershell to break apart large flat files (e.g. csv)

I created the below script to help break apart large flat files; to save myself effort opening files which are several gigs in a text editor and manually split them. So far I've only tested on sample ...
0
votes
1answer
75 views

Two similar functions for writing data to binary file using BinaryWriter

I have two functions for writing data to binary file using BinaryWriter. The first function has single data object as argument and looks as below: ...
2
votes
3answers
69 views

Replacing the second word of some matching lines in a file

I have a file that at some point contains a line of the following form: OutputFilename output.root I want to write a Python function that replaces the text after ...