In computing, input/output, or I/O, refers to the communication between an information processing system (such as a computer) and the outside world (possibly a display, an information storage system, or another information processing system).
2
votes
1answer
38 views
Multi threaded console IO
For many console applications it is handy to be able to receive input and output at the same time from multiple threads.
This is supposed to allow receiving input commands from multiple threads, while ...
5
votes
2answers
33 views
Slicing Stack Exchange data dump XML files into small bites
I was posed with a challenge when trying to load XML files from Stack Exchange into a SQL Server database; some of these XML files are extremely large (largest one being a whopping 67 GB in a single ...
3
votes
1answer
61 views
Simple XOR file encryption
In http://stackoverflow.com/a/39299060, I wrote the following program.
...
2
votes
3answers
124 views
Printing out vector<string> char by char
I have learned a bit of C in university and I'm now learning C++ independently. I'm trying to print out std::vector<std::string> ...
5
votes
2answers
156 views
Binary file Handling - Add,modify and display records
I have written a basic binary file handling program and have used goto, so I want to know how to improve this program by replacing goto with another function
...
2
votes
0answers
31 views
Writing a file sequentially
I've written a procedure which allows serialized writing of a stream. I don't in any way consider this done, but this is the beginning of it. I know there are other implementations out there like this,...
6
votes
3answers
81 views
CSV concatenator
I have the following code (running in LINQPad) which takes tens of thousands of CSV files and concatenates them to create a single file.
Each CSV file has two lines: a header line and a data line. I ...
5
votes
1answer
36 views
Testing file IO errors in python
Below is a simple class with two methods: the first calls open() to read in a file. The second calls the first method and does error handling.
There is also a ...
7
votes
3answers
222 views
Searching files in a directory for a string
I have the following static class that enumerates directories in a folder, then searches each file in the folder (it seems to only work with text files even thought I don't explicitly specify that) ...
3
votes
1answer
34 views
File shredder in x86 NASM Assembly
This is a file shredder utility that runs on Linux. It writes random bytes over the file contents, repeating this 48 times and calling sys_fsync after each pass to ...
11
votes
2answers
2k views
Taking arbitrary length input in C
Instead of having to use something like char buf[100500] and hope that no possible user input could be longer than 100500 bytes, I decided to make the following ...
3
votes
0answers
26 views
Get only intended input from user through the console
I finally worked out all of the bugs in this bit of code. I'm pretty proud of it and I wanted to give it to all of you so that you could have it if you wanted it for any console programs that you make....
3
votes
1answer
63 views
Input-reading library for Node.JS
Recently I have been busy with nodejs and I thought to create something like this Java input library, so I started with some rough code like below:
...
2
votes
2answers
61 views
Rust function to read the first line of a file, strip leading hashes and whitespace
I’m writing a Rust function for getting a title based on the first line of a file.
The files are written in Markdown, and the first line should be a heading that starts with one or more hashes, ...
5
votes
0answers
36 views
Positioning a file pointer with MPI I/O
This toy code uses MPI I/O to read from a binary file.
It goes through reading:
an ASCII header
the first 10 doubles from an array of 100 ...
3
votes
2answers
44 views
Optimized Int Reader
I am new in Golang, and decided to create a function that could cater to my needs of reading an integer from stdin. I need the function to be as efficient and fast ...
3
votes
1answer
44 views
Read file contents to string safely
I've just started to teach myself Rust. I've written the following code to read a text file and store the contents in a String. Is this the typical way of doing ...
1
vote
1answer
76 views
Sum over selected numpy.ndarray column and write to a file
I am trying to write the sum of selected NumPy array column and write to a file.
The following code snippet is working fine:
...
4
votes
2answers
57 views
Invoicing Program Python
This is my invoicing program I made for myself to keep track of purchases people made from me. (Yes I know eBay does this for me but I wanted to see what I could make.) Basically it can search the ...
5
votes
1answer
139 views
Printing fizzy lines
Challenge
Given a test case print out a FizzBuzz Series.
Specifications
The first argument is a path to a file.
Each line includes a test case.
Each test case is comprised of three spaced ...
7
votes
2answers
195 views
Reading binary files in XTF format
I have a few thousand binary files that have corresponding structs in them, followed by any number of bytes (this exact number of bytes is given in one of the fields in the structs). I read in data ...
2
votes
1answer
36 views
Updating certain values in text file
So I need to update some certain values within text file based on actual values there. Any advice on making it more effective or just readable is appreciated.
Example text file:
...
5
votes
1answer
94 views
Printing JUnit test results in file by changing and using the 'out' static variable of 'System' class
I'm building a framework for comparing files (in my own way) using JUnit. All test cases have been packaged in a JAR which is ran independently using a .bat file I ...
0
votes
0answers
55 views
Register a node-client code through an API call efficiently?
I've got a node_module that reads ArcValues for a user and updates the config of the node client at user's local (root). Like so:
...
0
votes
1answer
75 views
0
votes
0answers
26 views
Read a file into a list tail-first
This is some code which I created to read a file into a list tail first. In this case, I need to search for something in the file from the end first so this works out perfectly for what I need.
<...
6
votes
1answer
75 views
Counting newlines in a file
I've started to go through Node tutorials on nodeschool.io, and the second assignment was to write a program that will count the number of newlines in a file and print it out. My solution looks like ...
0
votes
0answers
212 views
Golang: reading and writing files in parallel
I am trying to read a big file line by line, inspect and cleanse each row and write to either of two output files depending on the outcome. I am using channels for this. I am still quite new to this ...
3
votes
2answers
60 views
Extracting the longest line from standard input
I'm reading the K&R book and I'm interested in a program which finds the longest line on the input. I've written the same code as in the book, but I wanted to do it myself. I tried to write my own ...
0
votes
1answer
63 views
Composing IO and Async in haskell
Whether based on MVar or TVar, async implementation are always based on operation on some underlying monad IO and STM.
Making Async a monad on its own, as in F# async computation builder, if done in ...
3
votes
2answers
78 views
Exercise 1-22 from K and R: line folding
I'm currently learning C with K&R, i'm right now in the exercise 1-22, but it's a little... hard to understand (at least for me). It says:
Write a program to "fold" long input lines into two ...
1
vote
0answers
24 views
Practicing rogue-wave I/O
What I'm doing:
Searching in current directory for a set of files.
Filtering the set.
Searching through the filtered set of files for a specific line sequence.
Write to an output file that line ...
7
votes
2answers
64 views
Higher performance reading shorts from binary file
I just got rejected at the tech interview of a job application. They gave me the following exercise for me to complete:
They gave me a binary file with 10 million pairs of 16-bit signed integers. ...
13
votes
2answers
237 views
Python 3 decompression routine 10x slower than C# equivalent
I'm relatively new to Python 3, especially IO programming, writing a Blender add-on to import model data.
The model data is available in a custom compression, and I originally wrote code in C# to ...
7
votes
4answers
366 views
Custom user input function
The program consists of 3 files: demo.c, mylib.c and mylib.h. The code is heavily commented.
...
2
votes
1answer
52 views
Read output from a subprocess executed by Python
I've written these 2 methods and I'm wondering if the 2nd method, which uses yield is more efficient or if I'm using yield wrong. Can someone refactor the 2nd method to make it more efficient for ...
1
vote
0answers
31 views
Customized streambuffer for C++ istream
Basically I implement a traditional file-descriptor-based streambuffer for istream operations. The implementation overrides the ...
1
vote
1answer
118 views
Reading from text files in C/C++ [closed]
I'm writing a program that has to check which are the two largest three digit numbers that are missing from a text file. I'm writing this in C++ and I'm trying to solve the mystery in a ...
3
votes
0answers
28 views
1
vote
1answer
53 views
Write the running time to file without capturing the program's output
I want to run an application and write (append) its processing time into a file. Also, I want to see the stdout and stderr output on the shell, but don't want to write it in a file. After running the ...
1
vote
2answers
118 views
Write into the same CSV file multiple times
I implemented an OutputWriterService.class to write content in the same file multiple times.
The writeToCsvFile method is ...
11
votes
1answer
90 views
Recreation of cat in C
I have a school project to create a program that works the same as the Linux cat. The code works, but I just need find out where I can Improve it or handle errors. ...
4
votes
1answer
31 views
Prompt system from reading a text file
I worked starting from basic example code from an exercise in chapter 10 of Java: A Beginner's Guide, Sixth Edition, the code in the exercise was not very good and I wanted to improve upon it and make ...
5
votes
1answer
36 views
Transferring data from one file stream to another
I am currently reading Clean Code and for fun and profit, I intended to refactor some of the Java Tutorials and since I wanted to improve my Exception handling, the Byte Stream one with its lots of ...
5
votes
1answer
68 views
K&R 1-20 Solution
I'm currently reading the infamous K&R C book and trying to solve Exercise 1-20. My solution looks kind of too simple, but it works. I've searched the web for different solutions, but they all are ...
1
vote
1answer
83 views
Using Pexpect for communication between multiple programs via I/O
I have a Python script that runs three compiled programs and makes them communicate via standard I/O. This is my first time using pexpect. My program runs very ...
5
votes
2answers
160 views
Prompting for a positive integer and validating user input in Java
I'm just starting out with Java, and trying to make a method to get a positive integer input from the console. My currently working implementation is this:
...
5
votes
1answer
133 views
8086/DOS assembly keyboard I=input, data loss in registers
I am working on a project for class, and it works as required by the rubric, though I am wondering if there is a slightly better way to implement a few things. I was docked a few points for an ...
3
votes
1answer
55 views
Reading arbitrarily long lines from a file that is redirected as input
So I have a file with a list of dates that are to be redirected as input to stdin and what the program does is it searches for valid dates, appends them to the output file and then appends all the ...
4
votes
2answers
381 views
Multiprocess, multithreaded read write on a single file
I've got a job to create a library that would be able to support multithreaded and multi process read and write to a single file. On that single file we would store C# models in an array in JSON ...