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

6
votes
3answers
86 views

Generate random 10% of file to be used in testing with Ruby

I'm new to Ruby, but not to programming. I just need a simple script that, given a text file, will pull out around 10% of the lines at random. Below is what I came up with based upon a Python script ...
4
votes
2answers
260 views

Manipulating filenames using Python

I was tasked with creating a script to be able to rename some files and then move them into different folders based on a code in the filename. ...
2
votes
1answer
51 views

Reading a binary file into object propery [closed]

I have a sequence of lines: ...
2
votes
2answers
53 views

Importing tab delimited file into array

I am needing to import a tab delimited text file that has 11 columns and an unknown number of rows (always minimum 3 rows). I would like to import this text file as an array and be able to call data ...
0
votes
2answers
77 views

How to search for a word in a sorted text file efficiently?

I want to write my own program to search for a word in a sorted text file. In the text file each word is in one line. I want to write this myself because I did not find any simple program (without ...
3
votes
0answers
35 views

SFTP JSCH security

My code below works fine (uploading files to a server directory), but as per my servers rules, I'm required to log in to SFTP using my main server username and password, obviously a little bit of a ...
1
vote
1answer
42 views

Making a list from user input - follow-up

I have made the changes that people have suggested from my previous question. I want to try and make it even tidier if possible. What can I change to make it more optimized? My ...
3
votes
1answer
63 views

Making a list from user input

I have wrote a program that lets the user open up there text file that would look something like this: 1 2 3 4 5 6 It would then let the user enter a name for ...
2
votes
1answer
39 views

Write int, short int or any integer value in a file in binary form using fputc

I am trying to write binary values in a file using fputc. In my case it is a short int. The file must be opened in "w" mode. ...
1
vote
1answer
19 views

Categorizing utilities into modules [closed]

I have two classes in my program, the one is PropertiesUtils and the other one FileUtils. This is the general structure of ...
7
votes
2answers
323 views

proper way of handling exception while reading user input from file

I am parsing a text file (UTF-8) and checking for several conditions that need to be satisfied for the code to be happy. If not, then there is no point to continue and the program should die. At the ...
3
votes
3answers
42 views

Keyfile Generator

This is a Java program that generates a random keyfile (for OTP, for example). ...
10
votes
4answers
1k views

Count number of words in a text file

Is this a good approach or is there some other solution that I am not aware of? ...
4
votes
2answers
57 views

Executing a file through a swing button

I am making a Swing application for light local database management and I have the button Run XAMPP. When that button is pressed this code is executed: ...
1
vote
2answers
59 views

Text file searching using SQL

I have the need to search a directory containing 1000+ files on remote servers where I only have access to SQL Server Management Studio and Explorer. I have written the below SQL statement which does ...
11
votes
4answers
458 views

File editing program

I have written a Java class to replace text in file. The file contains database configurations and is as follows: ...
2
votes
0answers
37 views

Fastest Windows script to move files from one did to a network dir

I wrote a script that moves files older than two days over to a network share (via scheduled task). Windows Task Scheduler doesn't seem to like the script so much, but it works well by itself. Is ...
7
votes
4answers
640 views

Read from a file and pick a random line

I've been learning Java lately and had some great feedback from the previous threads (hangman and guess a number games). I was challenged by a user to try to get this code done, so I'm posting it here ...
3
votes
1answer
29 views

Perl file sorting script

This is my first ever real 100% self made perl script, I'd like to know how I can improve it. ...
4
votes
2answers
294 views

Reading a file and storing the contents in an array

This is my code for reading a file with a delimiter. Any suggestions to help improve my code efficiency? I am not satisfied with using array data structure. Can any other data structure be used ...
10
votes
2answers
208 views

Reading text from 2 files

I've got 2 simple text files: besede.txt To je vsebina datoteke z besedami. V njej so razlicne besede ki imajo lahko pomen ali pa tudi ne. skrivno.txt 4 3 19 2 3 2 4 3 I wrote a ...
7
votes
3answers
244 views

Checking if file is within a directory for security

I have a security manager I'm writing for a Java program, and within the checkRead method, I wish to only allow reads to files within a given directory. The basis of it is that it will get a ...
2
votes
2answers
87 views

Python and Exception Handling IOError [closed]

I'm trying to work with exception handling by displaying "No Such File" when the file doesn't exist. I need to use a try statement. ...
5
votes
2answers
166 views

User input and reading contents of file

For full disclosure: this is an assignment for my programming class and I just want tips or advice on some of the code. Assignment details just for background information purposes: Write a ...
5
votes
2answers
845 views

Project Euler #22 - Name scores

I have written code in C++ 11 and check output with Project Euler site, and it is correct. I am not showing output, just to keep it secret, at least from my end. Please review my C++ 11 code. ...
9
votes
1answer
139 views

Console command tool

I have created a little console tool that simply does commands that you enter. The commands are stored in a txt file. Right now I only got 2 commands: getTime and ...
10
votes
1answer
268 views

File transfer over a stream

I am doing some programming on the side and would just like to know if I'm going in the right direction with my code. ...
0
votes
0answers
102 views

Optimizing a function to read bigger files in php

I have the following function that reads data from a csv file and it is supposed to take in data which is from a certain certain timeinterval in this case 07:59 and saves them up in another csv file. ...
3
votes
1answer
52 views

Reading a config file

I am relatively new to Perl and would like to check that the code I am writing docent have any major flaws in it or any bad practices. This is a fairly simple sub but one that gets used often. Seems ...
8
votes
6answers
5k 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? ...
5
votes
1answer
95 views

Function that converts file eol's

I've been unable to find a PHP function that will convert eol in files. This is what I have so far. It works, no errors. Your educated opinions, thoughts, improvements, potential bugs and ...
1
vote
1answer
1k views

Best practice to upload files on server using Rest Service

I am using building REST services for file upload on the server. Here is some code of that ...
8
votes
2answers
362 views

Sorting a set of numbers in a file using Java BitSet

I have implemented a program to sort a file consisting of numbers. The program generates a different output file with all numbers sorted in it. I have implemented this program using BitSet. I wanted ...
7
votes
1answer
94 views

Are these file handling functions safe?

I'm using these 2 functions to handle file input/output and would like to know if there's anything that should be changed. For content retrieval, enough space is allocated and the file content is ...
0
votes
1answer
94 views

How to ensure file exists, and get the absolutePath? [closed]

I need to: create an object with the absolute path of a file ensure the file exists My approach is to create a new Path and call toFile to make sure it exists - ...
3
votes
1answer
62 views

Class for file creation and directory validation

After reading some texts regarding creation of files under Python, I've decided to create this class which creates a new file on a directory, and creating a backup on the other directory if the file ...
6
votes
1answer
357 views

Updating a file through C++ streams

The following code is my answer to a Stack Overflow question: ...
6
votes
1answer
1k views

Client server application for file transfer

I have an application for transferring files from clients to a server. A client opens, transfers a file to the server and closes. The server is open and may receive multiple files. Also, when ...
4
votes
1answer
108 views

Universal File Duplicator

I made a simple Universal-File-Duplicator (Example: make 125 duplicates of one file). Very useful if you want to fill a whole USB flash drive or an old harddisk with an important file (Example: ...
0
votes
1answer
125 views

Java PrintWriter not printing data to file [closed]

This program is compiling just fine, and the variables and such seem to be passing through. However, when I open the text file there is no data. Can anyone point me in the right direction or nudge ...
4
votes
2answers
383 views

Perl Code Improvements - reading CSV file

I am very new to Perl, but quite pleased with my short introduction to it! So, scenario is I have a number of text files (they are reports from a financial system) stored in a directory. Each report ...
1
vote
2answers
634 views

Secure image upload class

I am new to Code Review and PHP. Last night I made the below image uploading class. It was the first time I made a file uploader to be used on a real site, so I thought I would share it here and on ...
5
votes
1answer
141 views

Improve my copying of a CSV file

I need to merge some large csv files but I feel that the way I am doing it is not optmized. It gets a number of csvfiles and creates one ...
3
votes
1answer
1k views

Writing integer to binary file

I wrote a python function that writes a integer to a file in binary form. But are there any ways that I can reduce the number of steps, is there a more efficient way to write a integer to a file? ...
1
vote
1answer
832 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
0answers
16 views

Python Coding improvements, Client Server Apps [duplicate]

I have written the following bits of code. Feel free to take and use/abuse. I am fairly new to python coding although I have been coding on and off for 30ish years, and I am sure I am writing python ...
0
votes
1answer
71 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 ...
0
votes
1answer
617 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
110 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. ...
0
votes
1answer
332 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.] ...