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
2answers
27k views

Reading output from multiple threads and writing to a file

There are 10 threads and I have 15 tasks. Now I have submitted all these tasks to these threads. I need to write all these threads output to a file which I was not successful. I am getting output by ...
2
votes
1answer
179 views

Use search query to find and modify files in directory

I've made a program that goes through your download directory (or any other directory; you just have to change the path) and finds the files that matches your query then asks you to rename or remove ...
5
votes
1answer
33k views

Writing/reading data structure to a file using C++

I wrote some piece of code which reads and write multiple data structures on a file using C++. I would be grateful to get your feedback on what you think about the code (it works at least when I ...
4
votes
1answer
186 views

Checking for an existing word in a file

This piece of code basically just asks for a word and sees if it exists in a file. If not, the user is asked if it should be added to the file. I am new to C programming and I want to know what you ...
6
votes
2answers
3k views

Simple C++ File Indexer

I didn't realize I am not a very good programmer at recently. I just come out from Uni, I want to become a reliable teammate. Please help me to improve my coding style/habbits. I have carefully re-...
4
votes
1answer
233 views

Reading contents of a file consisting of strings separated by a null character

This is my first attempt at reading the contents of a file consisting of strings separated by a null character. ...
3
votes
2answers
274 views

Android widget code

Anyone have any comments? Just trying to better my code if can be done. ...
5
votes
1answer
408 views

Reading a list of file paths and adding them to a map

I have many thousands of image files spread around various places and would like to copy them into one directory. However, may of the files are duplicates with the same names (often thumbnails or ...
3
votes
2answers
182 views

Rewriting file names according to the available screen space

I created a function that rewrites file names according to the available space on screen: ...
4
votes
1answer
437 views

Finding the end of file (EOF)

I wrote this code about finding the end of file (EOF). Please review this. ...
5
votes
3answers
784 views

FASTA file processing using Python to invoke external filters

I am very new to programming and this is my first functional code. It works fine but I'm sure that I could use a lot of optimization. If you see any blunders or would be able to help condense the ...
3
votes
3answers
245 views

Reading data from file

This reads a list of points from a file with a certain format: <number of points> x1 y1 x2 y2 How I can make it better? ...
10
votes
8answers
9k views

Replace strings in a file

I had to create an executable to search and replace strings in a file. This is to be used in my installer for text file manipulation. I have various placeholders in configuration files that I need to ...
7
votes
3answers
1k views

Creating and searching a dictionary of passwords and MD5 hashes

In this program, I have been asked to read an existing textfile (1324passlist) containing a list of passwords, then create a dictionary file with both the password and MD5 hash of the password on the ...
4
votes
1answer
2k views

Sorting file lines in natural order

I'm new to Java and have been through some tutorials and I'm in the next step of checking how I'm doing now. Is there a better way of doing this? ...
9
votes
2answers
354 views

Command-line utility to capitalize long words in a file

I have been developing a capitalizer in Python. This is actually a script that an end user will type at their terminal/command prompt. I have made this script to: Taking the first argument as a file ...
5
votes
2answers
144k views

Reading a line from a text file and splitting its contents

I have this kind of file structure MALE:FooBar:32 FEMALE:BarFoo:23 Where I would want to identify the gender and age of person, ...
5
votes
1answer
1k views

Inspecting properties of files

...
2
votes
1answer
3k views

Optimal method for writing bytes to file

I'm making a method to save a byte[] to a file. It's for a Java Helper I'm writing, so it needs to be able to handle any kind of system. I saw on this example the ...
3
votes
2answers
139 views

Simple file recurser

I'm using C# for a project and thought I would get a feel for the language by making some simple programs. My current program is a simple file recurser that prints the names of files and directories. ...
3
votes
1answer
592 views

GZip archiver for log files

It compiles, works well, solves my problem of zipping old or big log files and removes them from a hard drive. However, following this answer, I would like to know what was wrong with the code. ...
3
votes
1answer
238 views

JavaScript/PHP file uploader

I'm writing a JavaScript/PHP file uploader and I want to start this project off on the right track. I've started with this, a JavaScript Uploader object which will ...
5
votes
1answer
2k views

File reader/writer using XPConnect, ActiveX, LiveConnect, Java, HTML5 file storage, or HTTP

I am writing a file writer/reader in JavaScript; I want it to work on local files. It tries to use Firefox's XpConnect, falls back on IE activeX, falls back on Java LiveConnect, falls back on a Java ...
2
votes
3answers
99 views

Replace first occurrence of pattern in file

Here's my attempt to replace first occurrence of pattern in file with spaces. Effectively deleting it, and hopefully will allow me to "delete" it in a large file, ...
6
votes
2answers
426 views

Sorted grep in Haskell

This program implements a sorted grep, that is, a specialized version of grep for sorted files. It uses binary search for the lines of a file that begin with a ...
2
votes
1answer
355 views

Running a given command after each change in a file

I would love to hear some comments on this small script, which (I hope) reduces repetitive tasks such as page refreshing, compilation and so on to minimum. ...
6
votes
2answers
293 views

Haskell program to rename images based on EXIF data

Moved originally from StackOverflow, not knowing the existence of this sister site ... Must say I find programming in Haskell to require much more cognitive intensity than any other language I've ...
3
votes
5answers
7k views

Replace sequence of strings in binary file

I have searched for method to find and replace strings sequence in binary files without any luck. The main requirement was that method should not load all file in memory but rather use chunks. I am ...
4
votes
1answer
682 views

Parsing random phrases from a file

This essentially reads a specially-structured file from the scanner and then parses random phrases and prints them: ...
5
votes
1answer
1k views

Reading a binary file containing periodic samples

I have the following code for reading HTK feature files. The code below is working completely correct (verified it with unit tests and the output of the original HTK toolkit). ...
2
votes
6answers
942 views

Change HashSet to a set of strings found in a file

This function changes a HashSet in the root of the class called 'commands' to a set of strings found in a file at "plugins/UC/Commands.txt" (it's what was requested by the people using the plugin). ...
7
votes
4answers
23k views

Getting the length of a file in characters

Here's my function for getting the length of a file, in characters: ...
14
votes
2answers
298 views

Executing a program with a temporary directory and measuring the running time

I need a code review for best practices and code correctness of the following piece of code. run executes a program and validates in output. If the output is valid ...
12
votes
2answers
619 views

Extracting a set of numbers from a file

I do most of my programming in C/C++ and Perl, but I currently learning Fortran. I began by coding up a simple program, something that took me < 5 minutes in Perl (see this thread from BioStar). ...