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
1
vote
2answers
3k views

HTML5 File API Demo

I recently wrote a small demo that allows users to send and receive files from an HTML5 Javascript application. It's all client-side. I thought this would be a good place to get feedback about what ...
0
votes
1answer
340 views

Reading and writing an unknown character into an appropriately named file

I would like to refactor this code a bit further and make it better and more generic. As of right now, it is doing what I want it to do (reading a list of URL's, splitting the query and the ampersand ...
2
votes
1answer
27k views

opening a text file and building a dictionary

Need to write a function that takes an open file as the only parameter and returns a dictionary that maps a string to a list of strings and integers. each line in the text will have a username, ...
3
votes
2answers
212 views

Word analysis on input from a file

How do I improve the below code, which takes input from a file and does some word analysis? I find a lot of redundancy in it. I want to know a better way of implementing it. ...
-1
votes
1answer
3k views

C++ File handling, inserts ÿ character while copying contents [closed]

[Please don't comment on using Turbo C++. I know that it's obsolete but we are taught this way only.] ...
7
votes
1answer
17k views

Splitting a CSV file with headers

I have been looking for an algorithm for splitting a file into smaller pieces, which satisfy the following requirements: The first line in the original file is a header, this header must be carried ...
2
votes
1answer
2k views

Opening a list of URLs and splitting the queries into different files

I recently made a program in Python to open a list of URLs and split the queries into different files. I want to make this code more generic and simple. I am open to suggestions. ...
2
votes
2answers
1k views

File locking between server threads

I have written the below code where the server is getting requests from clients on a socket and creating a thread per client. Each client thread is then writing to a file which is common to all the ...
2
votes
2answers
500 views

Parsing argv with while-switch construct

I've been thinking about how to create a robust function that parses the command line arguments for valid filenames. I came up with a while-switch construct because that allows me to reduce redundancy ...
7
votes
2answers
12k views

Python: Open Multiple Files

I am trying to open two CSV files, one for reading and one for writing. The script should continue only if both files were successfully opened. My code seems to accomplish that but it seems like it ...
4
votes
3answers
2k views

Java app for getting metadata of millions of files in a directory

I am writing a Java app that gets the metadata of files in a directory and exports it to a .csv file. The app works fine if the number of files is fewer than a million. But if I feed in a path that ...
-2
votes
1answer
5k views

file downloading using jsp but not readable [closed]

I am trying to download files using jsp but then downloaded files are not readable. Suppose if i download pdf files then it can not opened,if i download jpg files then it can not opened and similarily ...
1
vote
3answers
3k 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? ...
4
votes
2answers
18k views

Counting letters in a text file

As a beginner Python programmer, I wrote a simple program that counts how many times each letter appears in a text file. It works fine, but I'd like to know if it's possible to improve it. ...
6
votes
2answers
702 views

Printing certain number of words from file

Other code review noted problems with commenting and non-C++ code. This post aims to follow up on those issues. Please check: Comments are appropriate Code is not C My test file contains: one ...
5
votes
4answers
386 views

Putting read data into a combined file based on certain attributes

I have a pretty big method where I read data from files and then put them into a combined file in a specific format based on an ID, first and end timestamp. I already refactored some of my code to ...
5
votes
2answers
320 views

Text file reading and printing data

MyText.txt This is line 1 This is line 2 Time Taken for writing this# 0 days 0 hrs 1 min 5 sec Nothing Important Sample Text Objective To read the text ...
3
votes
1answer
187 views

Use of pointers with file-reading program

I'm working on a school assignment, and it's working fine, but I have a feeling I'm over-using pointers, and I just can't think of a way to not pass a triple pointer to the function ...
3
votes
2answers
28k 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
34k 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
235 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
277 views

Android widget code

Anyone have any comments? Just trying to better my code if can be done. ...
5
votes
1answer
409 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
470 views

Finding the end of file (EOF)

I wrote this code about finding the end of file (EOF). Please review this. ...
5
votes
3answers
790 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
249 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
146k 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
142 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
594 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
239 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
101 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
428 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
356 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
294 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
684 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
956 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
24k views

Getting the length of a file in characters

Here's my function for getting the length of a file, in characters: ...