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).

learn more… | top users | synonyms

10
votes
2answers
1k 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 ...
0
votes
0answers
25 views

Should my Java method close the input stream? [on hold]

I have a Java class responsible for validating documents, it looks like this: ...
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
56 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
42 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
32 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
38 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
41 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
55 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
36 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
137 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
179 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
35 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
72 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
54 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
41 views

Reading a file chunk by chunk in QT 4.3.3

I have following code in QT in ...
0
votes
0answers
25 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
73 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
91 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
54 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
45 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
67 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
21 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
53 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
221 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
360 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
44 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
27 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
101 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

Write to terminal and buffer

...
1
vote
1answer
49 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
79 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
85 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
30 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
34 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
64 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
57 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
98 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
97 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
50 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
326 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 ...
4
votes
2answers
96 views

Reading file into structure

At the time I'm trying to read a quite big file into a C program for later user. The file size is in the range of 800 megabytes containing around 20 million lines of data of the following format: ...
3
votes
2answers
41 views

K&R C Exercise 1-14: Histogram of the frequency of types of characters

This is for K&R C Exercise 1-14: basically asking to create a program that prints a histogram of the frequency of types of characters. This is done with very basic C functions/knowledge as covered ...
1
vote
1answer
148 views

Reading input fast in Java for competitive programming

I have been solving problems on Timus Online Judge. In the beginning, I didn't worry much about I/O operations, so I just took some code from the internet and focused more on the logic. But after ...
3
votes
2answers
44 views

Constraining stdin in Python, v2.0

Rags, again. This is the rewrite of Read stdin like a dictator. From that post: All too often I find myself wanting to allow only a certain list of characters to be written to stdin, and only ...
3
votes
1answer
55 views

Vigenère cipher as an IO filter

I implemented a Vigenere encoding and decoding class. Ideally, the program should be able to take any abritrary file, read into an array of byte, and decode it. ...
5
votes
1answer
62 views

Implementing cat function in Julia

I wanted to implement the cat function in Julia and I ran a few test cases but I am not sure if I am missing anything: ...
1
vote
0answers
41 views

Reading content of directory for each HTTP request

I have a piece of code written in node and I wanted to know if I am in the right direction. Basically I have a site where the homepage lists 6 vehicle cards. Every time the page is requested I do the ...
4
votes
1answer
39 views

Reading entire contents of file at a given java.no.file.Path into a String

What I'm wanting to do is create a String readFile(Path filePath, Charset encoding) method, that returns the entire contents of a given file. I'm wanting the ...
8
votes
4answers
1k views

Creating a unique file name in C#

I find that I am often writing files where the names either: Need to be incremented (rather than overwriting a file that already exists in the directory with the same name) Need to be timestamped ...