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
0
votes
1answer
12k views

Sort data from a text file in descending order using quick sort

I have a text file containing the following data. ...
4
votes
2answers
155 views

Using a radix tree to find case-insensitive matches in large files

I'm using a radix tree library to find case-insensitive matches from several relatively large files (~24 files each on the order ~150MB). My current algorithm requires me to read the chars of an ...
9
votes
3answers
142 views

Archiving files into directories

This program moves files to a backup directory, archiving them by year of last modification. From a directory like : ...
6
votes
5answers
61 views

Compare files, returning first differing line

Exercise 7-6 from the K&R book. Compares 2 files, printing the line number and content with the first dissimilarity. What am I doing that could be improved? ...
12
votes
2answers
828 views

A minimal CLI password storage and retrieval manager

Its primary function is to retrieve+copy a PW to your clipboard. It'll also add, update, delete key/value(accountName/password) pairs from a JSON formatted dictionary(separate .txt file). It's ...
4
votes
2answers
773 views

Creating multiple files from a list

This piece of code is to get random samples from two String lists, pos and neg. Based on a ...
3
votes
3answers
84 views

Reading and classifying lines from a file

I'm new to C which I'm learning in university now, and I'm not sure if the following is considered in C good practices or not. For an assignment in a simple Classification problem I wrote the ...
3
votes
1answer
186 views

Exporting an object to a ZIP file

I have my own type of object, which implements Serializable. Here I have one called "extendedFormat" (not a terribly helpful name, yes, I know). I'm writing it out ...
3
votes
2answers
207 views

Extract SSID and BSSID from a file

I have file called Network.txt which contains SSID and BSSID as below: ...
8
votes
2answers
5k views

Python code that compares two files byte by byte

I wrote a Python (2.7) script that compares a file byte by byte. filecmp was not suitable for the application because it compares metadata as well. How can I ...
1
vote
1answer
84 views

Overwrite disk space for the purpose of deleting old data

I have written a little program that overwrites memory. It creates useless files in a folder named "folder" (I am so creative). The purpose is to overwrite old data. It's not a very professional ...
4
votes
1answer
136 views

Write a message to a log

I have started to read Robert C. Martin Clean Code book. To learn and gain more expreiences I wrote a single Log class. So I want some suggestions to improve this code.. This is a part of the Log ...
7
votes
2answers
1k views

Find and rename all png files

I have such problem : find all png files to disk and rename them as I did: ...
0
votes
2answers
93 views

Give function get file extension for you

I have written a function that retrieves the extension from a given file name for you. I would like to make this more efficient and increase it's performance. ...
3
votes
1answer
704 views

JSON Cache Program

I have some code that is intended to be a package (so that it can be accessed via import cachejson). Here is the code for the package: The update variable is ...
1
vote
0answers
34 views

Script to append a new method to a XAML code-behind file

My company is converting a VB.NET project to a C# application and I was tasked with writing a script to automate part of the process. In particular, given information about a control name and event in ...
6
votes
1answer
99 views

Merge sort practice

Never written a merge sort for huge files before. So after this mornings question I though I would give it a go. ...
0
votes
1answer
109 views

PHP Cache weather in a file

I'm using the darksky api to get weather data for a display board website. The free version is limited to 1000 api calls per month. I have a lot of devices (iPads) displaying this information in ...
6
votes
2answers
472 views

Creating index to a file in C

My task was to index a file in C. I'm getting one argument: file name. The index should contain all the words and a line list which appears in. A few notes: Big and small letters are the same. A ...
4
votes
1answer
45 views

Read reference data from external file

This is a function from a program I am working on for my internship, which involves research in computational science. I have some text files with reference data in a directory ...
7
votes
2answers
132 views

Grouping Equivalent Files in Filesystem

The docstring in group_equivalent_files should be self-explanatory for what I'm trying to do. I'm specifically trying to group by equivalent files as opposed to just finding pairs of equivalent files. ...
4
votes
2answers
2k views

generate a file name with format Name(Number).extension

I am writing a program which downloads a file from a URL. Because the name of the downloaded file depends on the url, there is a risk of duplication if the user downloads the same file twice. For ...
2
votes
1answer
45 views

Reading in millions of lines of AOL query logs for query suggestion/expansion

I am working on a query suggestion program, and to faciliate this, I am reading in millions of AOL queries logs. The logs have this format: ...
1
vote
1answer
56 views

Read date from a file and rename two files using the date

Problem I have image files that are RAW data and have the extension .NEF Whatever edits I make to these files are stored in what is called a sidecar file with the ...
-2
votes
1answer
41 views

Finding phrase in specified files v2 c++

Please provide constructive feedback so I can learn from my mistakes. Please tell me what I did right and where I came up with very good solution and where I should improve. Here is the code (Please ...
3
votes
2answers
619 views

C program to handle information of cars and owners

This is a school assignment, it's the longest program I've wrote this far, and I feel it's a bit messy and all over the place. I will try to translate the assignment to the best I can: We have a ...
1
vote
1answer
201 views

C++ Reading Data in a File

I'm not sure if I should ask here. The program worked it's just that I'm not satisfied how I implemented it because I used two while loop to read a specific data and I have no idea what am I doing. ...
4
votes
2answers
913 views

Scanning through logs (tail -f fashion) parsing and sending to a remote server

I have a task at hand to build a utility which Scans through a log file. Rolls over if a log file is reset. Scans through each line of the log file. Each line is sent to an executor service and ...
1
vote
2answers
9k views

AES Encryption/Decryption of Files and Bytes

I have gathered some information about aes256 in c# from the internet and put together this code and I would like to know if this is secure or if its lacking in security. Working encrypt/decrypt ...
3
votes
1answer
89 views

Follow-up 2: Copy File, remove spaces in specific lines

This is an iterative review: The Original Question | Follow up 1 Differences to Follow up 1 This iteration tries to take the previous review to heart and see how it turns out. It sacrifices the ...
3
votes
2answers
148 views

Follow-up 1: Copy File, remove spaces in specific lines

This Question now has a follow-up question After learning a lot about applying OO principles, interfaces and a bit about argument-handling I post a revised version of my previous code. This is still ...
7
votes
2answers
134 views

Finding phrase in specified files

Please provide constructive feedback so I can learn from my mistakes. Please tell me what I did right and where I came up with very good solution and where I should improve. Here is the code (Please ...
4
votes
1answer
400 views

Copy File, remove spaces in specific lines

This question now has a follow-up question 1 and follow-up question 2 As an exercise in writing decent code and because I learn best by example, I wrote this program and would ask for a review so ...
5
votes
4answers
771 views

change space to underscore in filename using C

I have written my first C program that renames spaces in filenames to underscores. I wonder if there is an easier or more efficient way: ...
3
votes
1answer
1k views

Python .WAV generator

The following is a .wav file generator that I wrote briefly while (re)learning about audio sampling: ...
5
votes
2answers
161 views

Read lines from a file in chunks

I created a function to read lines from an file into chunks. My hidden agenda in creation this script was in python the yield function in interaction with chunks. The script works fine, but now i ...
7
votes
2answers
2k views

Read file into char*

Because I use the task so often, I wrote a C header for reading a file. I never formally learned C, so I'd really appreciate a code review on the code. As a matter of personal taste, I do not put a ...
3
votes
1answer
6k views

C program to find and replace a word in a file

This program will perform a find and replace on a single word in a file, with the condition that the new word must have the same length as the old one. It will also display the number of occurrences ...
6
votes
1answer
155 views

Read a file as 4-line chunks

I want to extract the file content into chunks with perl. I have prepared some code snippets which read a file content into chunks. I want to know what is the best way in Perl? Example-File-Content: ...
4
votes
3answers
121 views

Add Number to First Number on Each Line of File then Write to Another File - Python

Python program adds a value to the first number in a fixed width file of variable length. Normally one line header. Before user deletes original file and renames new file they need to check it. How ...
1
vote
4answers
3k views

Saving the contents of a TextArea to a file

Can this method be modified to be more efficient? ...
2
votes
2answers
93 views

Extracting an IP address from a hosts file by hostname

I am currently working with Vagrant for the first time, and therefore also working with Ruby for the first time. I have a specific hostname and IP address I would like set for my VM, both of which are ...
2
votes
4answers
2k views

Randomly pick a first name from a file

I have a very easy question for you guys out there. It's been a while since I took my programming courses (switched majors) but am trying to get my feet wet again. Objective: I will be creating a ...
7
votes
1answer
800 views

Saving temporary file for plotting audio waveform

I am developing a web application in Flask - Python. My goal is to let the user upload an mp3/wav file. This file will (for the scope of this question) get processed by the server and a picture ...
3
votes
2answers
145 views

Correcting duplicate names in generic array - follow up

Follow Up question of : Correcting duplicate names in array I have an array of file names. For example: ...
5
votes
3answers
1k views

Correcting duplicate names in array

I have an array of file names. For example: string[] files= { "one.zip", "two.txt", "one.zip", "three.txt", "three.txt", "one.zip" }; And I've developed the ...
2
votes
3answers
992 views

Loading dictionary words into a trie

I have here a program created for pset5 of the CS50 course. The program compiles correctly and does as it should. However, is there any way to improve the run time of this program? Are there any ...
4
votes
2answers
207 views

Optimize Huffman Compressor in C++

I'm currently writing a Huffman compressor for educational purposes. I want it to compress/decompress files less then 5mb. The time limit is 5 seconds. Now it compresses a 5mb file in almost 8 ...
3
votes
2answers
91 views

C program to write 5 lines to a file then print the lines except the second line

This will read 5 lines into a file from stdin, then print all the lines except the second one. I used an array because I'm not sure how to do dynamic memory allocation. ...
0
votes
1answer
61 views

How I can make file multiple of `segmentSize` [closed]

I multiply the original file and cut a piece of final file with intention to do it a multiple of segmentSize times with minimum loss of data. Example: I have a ...