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

2
votes
1answer
14 views

Saving and loading parts of configuration

I have a piece of code where I have string pairs (eg. 'a' and 'AA'), where both have their own unique ids. Id for first object is configured by user and second id is received at some point during ...
4
votes
3answers
52 views

Writing huge 2D vectors to text file too slow

I have 10 large (34 million cell) 2D gridded vectors storing doubles. When written they are over 200 MB in size. I use an ofstream object to write them to a text ...
18
votes
4answers
215 views

Convert Bitmap Font to Texture Atlas

I wanted to render the textures that comprise a bitmap font glyph onto the screen directly as an Image in libGDX. When you make a bitmap font using a program (such ...
0
votes
1answer
64 views

Appending to file slowdowns the process

The process: I read the lookup and create a list aa. I traverse through the glob.glob("C:\\project resource\\dump\\*.html") ...
2
votes
2answers
101 views

Load text file into an array in Swift

I'm drowning in Swift optionals and error handling syntax. I'm just converting a text file into an array of Strings. One would think that this could be a simple two or three liner but by the time I ...
8
votes
6answers
2k views

Sorting a list of first names from a text file

I applied for a job as a C#/.NET Junior Developer, and had a test to do:: Using names.txt (right click and 'Save Link/Target As...'), a 46K text file containing over five-thousand first names, ...
1
vote
0answers
32 views

Chunked file upload

I'm working on an PHP application that will allow (but not require) chunked file upload (from jQuery File Upload on the front side). I tried to find appropriate code and was only able to find the ...
4
votes
1answer
618 views

Ruby script to load .xlsx files into a MySQL database

I put together this Ruby script (1.9.3) to load data into MySQL from many .xlsx files that contain data entered by people. These files typically have many illegal characters and it has been difficult ...
0
votes
1answer
36 views

Simplicity decider

I was interested in the Code Golf challange about simple text. The spec is: Write a function that from a text returns the non-common words. I assumed non clean input so I cleaned it before ...
2
votes
1answer
40 views

Reading numbers from a file with lazy ByteString

This is my code for lazily reading a very large file which contains numbers separated by a new line character. Is there a way to simplify this using the ByteString ...
2
votes
4answers
231 views

Removing the extension from a filename

Let me know if the given code can be improved or optimized: ...
2
votes
1answer
46 views

Sort files by the type of file

I need to sort files by the type of the File. To accomplish the task I first wrote the code below: ...
3
votes
2answers
159 views

Returning the length of the File in B/KB/MB

The method length() in File returns the length of a file in Bytes, this code transforms that into b/kb/mb as can be seen in the ...
7
votes
2answers
154 views

Manage multiple file writes in C

I have a very simple C program that continuously reads from a temperature sensor and displays the temperature on two 7-segment LEDs. Reading is simple, but to display the LEDs I need to write to 14 ...
5
votes
0answers
52 views

Processing files with streams

I'm using iojs. I have to read some files as a stream, process them with a same function and join them back into a stream. So, I decided to create my own solution with ...
4
votes
2answers
53 views

Longest lines of file descending

This is a challenge question from codeeval.com: Write a program which reads a file and prints to stdout the specified number of the longest lines that are sorted based on their length in ...
3
votes
1answer
70 views

Class in a DLL to extract data from a file via many accessors

I'm making a class that takes a path to a text file as an argument in its constructor, and then parses the text file and pulls out a lot of data that it stores as private members. Most of these ...
8
votes
3answers
695 views

Find the greatest number in an array

The program reads a .txt file that contains lines of numbers. The first one has one number N and the second one has \$N\$ numbers as the first line says. The \$N\$ numbers is \$1 \le N \le ...
1
vote
3answers
1k views

Counting repetitions in a file

I've written this code to get input from a file and count the repetition of number of that file and give output to another file. How can I make this code better? ...
19
votes
2answers
1k views

Please Save My Name

I wanted to create a save game system for my city building game that did not require the player to input a name for the city. It was also important to allow infinite save games, so I could not just ...
7
votes
1answer
50 views

Python XML parsing, extraction and renaming files

I've written some code to: Parse an XML file. Extract some strings. Make copies of the original XML whose names are suffixed with the extracted strings. Please review this. ...
8
votes
2answers
180 views

Reusable, generic save method

I am developing a Python script that will process large amounts of data from an experiment. Files are read in, calculations are made, images are plotted and saved as .pngs, and calculated parameters ...
4
votes
1answer
97 views

Move and rename images into separate folders

Basically, we came up with this task at work. I was wondering if there's a shorter and cleaner way of doing the following in some other language (or even improving what I did with Ruby). We have a ...
1
vote
1answer
44 views

Aggregation of files

I have millions of files in a folder. File types will be with the name PES_timestamp and DOM_timestamp. I have to aggregate all PES and DOM filenames into one file which has the same filename. The ...
1
vote
0answers
29 views

Favicon Downloading Script

I use this file to download favicons and was wondering why it seems to be so complicated. I've noticed that people seem to save their favicons in many different types of ways. On top of that, PHP ...
5
votes
1answer
107 views

Edit configuration files script

Script designed to avoid manually edit configuration files by support. Config file example: ...
4
votes
2answers
245 views

Script to generate templated PHP code

I've created a script to create a module in our MVC framework. The structure of the module is like this (for this example, the module is called test): ...
2
votes
2answers
78 views
7
votes
4answers
175 views

iTunes playlist copier

When you own an Android device and want your iTunes playlist to be copied over onto it, what do you do? What if your playlist hits something in the region of 20GB+ ? Well, I am sure I could've paid ...
6
votes
1answer
393 views

Merging multiple JSON files using Python

I have multiple (1000+) JSON files each of which contain a JSON array. I want to merge all these files into a single file. I came up with the following, which reads each of those files and creates a ...
5
votes
3answers
198 views

Writing a large file of numbers

Basically, I want to write a huge file of numbers. Each line in that file should contain one number. This program below is extremely slow (obviously) but it works. It writes one line after line and ...
1
vote
1answer
24 views

Inserting filename, reading data, inserting regex, and testing if each line matches - version 2

This is a improved version of the program seen in my older question. This program first displays a menu which shows some options that the user can select. Each option will the respective functions ...
3
votes
1answer
52 views

Inserting filename, reading data, inserting regex, and testing if each line matches

This program first displays a menu which shows some options that the user can select. Each option will the respective functions which do some things. The user can insert a filename, read data from ...
15
votes
6answers
52k views

Fast way of searching for a string in a text file

I have written this code to search for a string in a .txt file. Is it possible to optimize the code so that it searches for the string in fastest manner possible? ...
3
votes
3answers
145 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? ...
7
votes
4answers
882 views

Reversing the lines of a file

I am trying to reverse the lines of a file by reading the file through an array. Is there a more efficient and quicker way of achieving this? ...
6
votes
2answers
337 views

The most efficient way to merge two lists in Java

I am looking for a way to merge two files with a list of distinct words, one word per line. I have to create a new txt file that would contain all the words of the first list and all the words from ...
2
votes
1answer
65 views

Looking for identical files (or directories) in a filesystem

Dilemma The code below is in its infancy, but for now is an effort to crawl my entire file system and find duplicates whilst adhering to a variety of exclusion criteria. My current strategy for ...
8
votes
2answers
162 views

Text Analyzer - Properly implementing Java coding style

As a new Java learner I would like to improve my coding style. I wrote a program which gets as an input a file name, and asks for two file names for the output. The first output file includes all the ...
4
votes
1answer
71 views

Reading a text file API 15+

Is there a faster, more efficient way to read a text file than this implementation? Taking into account phones capabilities: ...
2
votes
1answer
68 views

Reading the bytes of a PDF

I'm quite a newbie in Python and I want to speed up this method since it takes very long time especially when the size of the input file in Mbs. Also, I couldn't figure out how to use Cython in the ...
5
votes
2answers
183 views

Showing the contents of a file

This program reads a filename from standard input and then prints its content. Please review: ...
2
votes
2answers
182 views

Write to files in Delphi

I'm doing a program in Delphi, writing in all kinds of files, either text or executable: ...
15
votes
2answers
1k views

Can I buff up your file?

Here I have a method for reading the contents of a file into a buffer and returning whether or not it is successful. Here is what I would like reviewed: Speed: Am I reading in the file as fast as ...
3
votes
1answer
59 views

Input data from file, calculating average by a function

I want to thank you guys firstly for your previous comments and feedback. Really appreciate it. I am learning C with school at the moment, but I plan to be "fluent" in C at the end of august of this ...
2
votes
1answer
271 views

Extracting ZIP, JAR and EPUB files

I wrote a utility class that is used to extract the contents of a ZIP file to a destination folder. This is a very small class, but it has several practical applications: it can not only be used to ...
1
vote
1answer
85 views

Search string by regex in files and write line of found string

I am searching in files with extensions .xml, .java, and .properties strings that match a certain regular expression. When I find it, I write it to the file with the filename, line and string ...
2
votes
3answers
85 views

Simple and safe file reader for C

As an exercise to improve my coding ability in C, I have attempted to write a simple and safe file reader. I believe this should be portable as well to major platforms (correct me if I'm wrong). For ...
2
votes
0answers
61 views

Organising loops for parsing a text file

The following code is from a utility I've written for myself. It takes a file in this format: ...