File handling refers to the set of tools, functions, and libraries to work with files and file handles. Creating, writing, appending, moving, and deleting files fall in this domain.

learn more… | top users | synonyms

0
votes
1answer
45 views

Sending files from two computers on different networks

I've tried to achieve some sort of peer-to-peer TCP connection through UDP hole punching (as both computers are behind routers with NAT) but I haven't got it to work. Now I'm wondering whether it is a ...
0
votes
0answers
63 views

Can I use write a null value into a file? Turbo C++ [on hold]

OK So I've been trying to create a manual database in C++. I have a structure called node, which has all necessary datatypes. struct node { int x; char y[100]; float A; }; now, I want the user to ...
12
votes
7answers
2k views

Is it necessary to read every single byte to check if a copied file is identical to the original?

I recently learned of a program called Total Commander. It's a Windows Explorer replacement and has its own stuff to copy files. To check whether the files are identical, instead of calculation a CRC, ...
-1
votes
0answers
18 views

Segmented file downloading potential gains vs excess overhead/problems

I'm writing a download manager, i want to get as much speed as i can from my downloads and I'm thinking about implementing segmented file downloading with conjunction to parallel download for each ...
1
vote
1answer
32 views

How to deal with dual servers and temporary files

Our application is hosted on a dual-server environment - when one server is overloaded with work, a secondary server will take its place in processing certain actions. For most purposes, this isn't a ...
6
votes
3answers
150 views

Where in an MVC web application should writing files locally go?

In my web application that uses an MVC framework which has different modules for models, views and controllers I talk to several databases and APIs. Those are implemented as individual models. A lot ...
0
votes
1answer
53 views

What locking mechanism should be used when persisting data to files

I am beginning to learn how to create web applications from a golang tutorial. For simplicity, it persists data to files instead of a database. The complete code creates a server that can handle ...
9
votes
3answers
390 views

What is a good design for allowing backwards compatibility of files between different versions of software?

What is a good design for allowing backwards compatibility of a file type between different versions of software? For instance, how does microsoft get word 2007, 2010 and 2013 etc... to all open docx ...
7
votes
1answer
1k views

“Read” a file without using a file pointer

I was asked this question in an interview. I'm somehow supposed to "read" a file into my C program as input without using a file pointer (including "f" functions, e.g. fgets, fscanf etc.). I'm also ...
0
votes
0answers
29 views

Uploading Named Binary Tag files(NBT) via PHP - a bit scared security wise

I'll cut right to the chase. I'm building an application that deals with NBT files(named binary tag). They are being uploaded via the usual PHP methods. I haven't dealt much with uploading files in ...
0
votes
0answers
42 views

Handling image and audio files in iOS

Currently I have an iOS app that downloads image and audio files from a server, but each view controller downloads its own set of image and audio files (This is because each view controller needs a ...
5
votes
2answers
405 views

Hard Coded File Paths - Solution?

Say you have an application that saves image(.jpg, .png etc) and text(.txt, .xml) files, and the application has all of the files paths hard coded throughout code, per the example below. Assuming the ...
8
votes
9answers
4k views

Multithreaded file copy

There is an utility we have which is used to upload files (and perform other operations on the file) to a network shared location. The file size tends to vary from a few mb to 500 mb. A suggestion has ...
0
votes
2answers
107 views

Is renaming an 'alias' for moving?

Is it true to say (on Windows and Unix\Linux\OS X) that renaming a file or directory is just an alias for moving? e.g. Are there any side effects to either which are not present on the other? Does ...
5
votes
2answers
140 views

How to distinguish whether a MS Word file is being saved or deleted? (“Save” deletes then re-creates)

I maintain a tool that syncs files between a client computer and a document management server (using the CMIS protocol). Versions history (on the CMIS server) is important. When saving a document ...
40
votes
2answers
3k views

What is the benefit of writing to a temp location, And then copying it to the intended destination?

I am writing an application that works with satellite images, and my boss asked me to look at some of the commercial applications, and see how they behave. I found a strange behavior and then as I was ...
0
votes
1answer
296 views

Elegant way to count the number of files in Zip archive

I need to count the number of files in several zip archives for error checking. I've found several answers on SO but nothing elegant. I currently have the following code which works but it's not ...
0
votes
1answer
242 views

Using XML to store and edit data records in Java

I want to use XML to store data for an assignment . In this Java assignment I'll get data from the user in form of lines in a file below INSERT INTO student(id,name,family,isMale) VALUES ...
0
votes
0answers
68 views

How to design a server that does not interrupt downloads?

I'm building a Node server that serves large files for download and streaming. It will be necessary to modify these files on occasion, sometimes in bulk with a script. I want to be able to update them ...
7
votes
5answers
1k views

Test Driven Development: A good/accepted way to test file system operations?

I am working on a project at the moment that generates a table (among other things) based on the contents of a file-system, and and in turn does some meta-data modifications on the things it finds. ...
0
votes
1answer
168 views

Making a database and related operators using files and JSON in java [closed]

I'm trying to write a program that reads operations from a file. these operators look like below : CREATE TABLE student(id:integer, gpa:decimal, name:string, family:string,isMale:Boolean) INSERT ...
4
votes
2answers
203 views

Design, how to utilize The Hardware (multiple threads and/or GPU) while indexing (via a database) a very large set of binary files

Problem How can design my file parser to maximize the hardware when processing (creating meta data for) a large file (i.e. how to avoid being blocked by IO and running out of memory) preferably ...
-1
votes
1answer
298 views

Laravel - BLOB File Management System - Possible obstacles?

I'm working on this weird project where I need to upload huge files (500mb+) and store them in a postgresql table as a blob. Before you start telling me that storing files in the database is bad and ...
1
vote
3answers
127 views

Which part of the code should rewind a file pointer?

If you had a function that took a handler to a file and then performed some actions that moved the pointer, would you expect it to put the pointer back when it was finished? Additionally, would you ...
0
votes
2answers
152 views

Serving a file from a private directory [closed]

I have a PDF that needs to be accessible for multiple unrelated areas across a website. I don't want to reveal anything about where the file is downloaded from and I want to only upload the file once. ...
1
vote
2answers
350 views

Is there actually an advantage to using Win API calls for file access?

I remember coding file access using the Win API about 15 years ago. It was much faster than using the FileStream of my language at the time (Delphi). I spent a while today experimenting in C# under ...
1
vote
2answers
219 views

TDD and Writing Tests for File Processing

These questions are very similar: TDD for batch processing: How to do it? and TDD: how to test file outputs? but I'm still left wondering some things The app processes files/pdfs. It takes them from ...
0
votes
1answer
85 views

Is it possible to save and load a decorated object

I am wondering if there is an easy way to save and load a decorated object in c++ as i have never done file handling in C++ before. Currently the only object type I need to save is objects that ...
24
votes
3answers
4k views

Should I pass in filenames to be opened, or open files?

Suppose I have a function that does things with a text file - for example reads from it and removes the word 'a'. I could either pass it a filename and handle the opening/closing in the function, or ...
2
votes
3answers
101 views

Smart fallback for line endings in code files? [closed]

What do you recommend as a default fallback for line endings if the operating system cannot be determined? Example Mac OS up to version 9 uses carriage returns (\r) for line endings. Unix-like ...
1
vote
1answer
78 views

Holding of files being edited in a text editor

I'm writing an implementation of Ex (hopefully Vi eventually) as a personal project. I need to somehow store an identifier for the file associated with each buffer. In terms of security/race ...
2
votes
2answers
184 views

Recreating files from shell script or java?

I have java application which takes a file, which is created by a process running on terminal. I start the process using a small shell script. Then run the Java application and it reads the file ...
0
votes
2answers
169 views

Whats a good structure to save and retrieve locations of images?

I got a java-ee application, where I collect informations about movies. Im my backend I provide data like the name, description, genre and a random uuid. I also got lots of related files, which are ...
1
vote
2answers
319 views

Is creating and writing to one large file faster than creating and writing to many smaller files in Python on Linux?

If using Python on a Linux machine, which of the following would be faster? Why? Creating a file at the very beginning of the program, writing very large amounts of data (text), closing it, then ...
1
vote
2answers
628 views

How do I / what is the best way to interact with a desktop application from a browser web application?

Situation: We have a desktop application. We also have a web application. We need the two to interact with each other. So when a button is pushed in the web application, the desktop application ...
1
vote
1answer
308 views

Design Pattern: A single class with multiple purposes, or multiple extended classes each with their own purpose in PHP

I'm working on a PHP framework called Carbon CMS. This framework will be used as base to build larger web applications on top of it. This framework should provide all kinds of interfaces such as ...
2
votes
3answers
375 views

Quickly compute added and removed lines

I'm trying to compare two text files. I want to compute how many lines were added and removed. Basically what git diff --stat is doing. Bonus points for not having to store the entire file contents in ...
4
votes
1answer
188 views

How should I recursively process a file in Haskell?

Basically I'm expanding a literate program in Haskell. There are two things I need to look for to expand. Here's an example file: program.c.lit: ============== Some comments in the source file that I ...
3
votes
2answers
284 views

Why do binary files load quicker than alphanumeric text files?

I've noticed that when I load/store large data files in a binary format, the program runs much faster than if I load data from an ASCII encoded file. Why is this the case? The data in my case is ...
2
votes
1answer
192 views

How to name filename parameter to make clear it should contain full path? [closed]

I'm seeking vital naming of string filename parameter in parameter list used in various methods where filename with full path is expected. In many cases also UNC path can be actually supplied as full ...
0
votes
2answers
2k views

Way for java program to read file from when it was stopped

I am working on an application that reads a log file, looks for a specific string, sends alert emails and saves data from the file into a database. The reading functionality is working well, but I am ...
1
vote
3answers
317 views

How to make a random-access archive of text files?

I wrote an application that tests the performance of evolutionary algorithms. This application performs a run of the algorithm which consists of several generations. The data which is produced by my ...
5
votes
1answer
164 views

Is there a standard way of cleaning data files?

Having spent quite a lot of time working in software companies that deal in medium to large data sets, I've seen that a choke point in their processes is often prepping data files for loading into ...
1
vote
2answers
387 views

Retrying a statement or call in a catch block - code smell or anti-pattern?

I'm wondering how better to perform this operation for a large amount of files. The bit I'd like some thoughts on whether this copy/paste is acceptable enough of a tradeoff. try to write a file if ...
-2
votes
4answers
128 views

How often should saving to disk occur in an automatically saving text editor? [closed]

I am developing a simple text editor and would like the application to save the text automatically. In other words, the user would never have to press a save button. I have seen other applications ...
3
votes
2answers
775 views

How to simulate inner join on very large files in java (without running out of memory)

I am trying to simulate SQL joins using java and very large text files (INNER, RIGHT OUTER and LEFT OUTER). The files have already been sorted using an external sort routine. The issue I have is I am ...
4
votes
3answers
687 views

What is the best practice for reading a large number of custom settings from a text file?

So I have been looking through some code I wrote a few years ago for an economic simulation program. Each simulation has a large number of settings that can be saved to a file and later loaded back ...
0
votes
3answers
183 views

How can I handle this string concatenation in C in a reusable way

I've been writing a small C application that operates on files, and I've found that I have been copy+pasting this code around my functions: char fullpath[PATH_MAX]; fullpath[0] = '\0'; ...
0
votes
2answers
1k views

Large MySQL Batch Inserts From PHP: Run insert from script, or save as SQL file?

We have a large dataset that's current residing in many, many spreadsheets. I've been tasked with getting part of that data into our MySQL DB. When all is said and done, I will probably be inserting ...
3
votes
1answer
132 views

What does it mean that file IO binary flag is only relevant on Windows

I was reading a question and one of the comments mentioned that "The binary flag is only relevant on Windows". Given the context of the question and answer, I interpret this statement as on ...