Questions tagged [io]

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

28 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
10
votes
0answers
261 views

Asynchronous serial port communications class in C++

Please review my serial port class written in C++. It is completely asynchronous, ie event driven. My idea for later is to inherit from this a sync_serial, where timeouts can be specified and it ...
9
votes
0answers
367 views

Idiomatic way to implement `tail -f` in clojure

Disclaimer: This is just an educational task to learn how to program in clojure and switch brain to immutable state-way of developing (the provided snipped has some unused variables which I didn't ...
6
votes
0answers
106 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 ...
5
votes
0answers
82 views

Convert a mix of latin 1 and UTF-8 to proper UTF-8

The following program takes an arbitrary byte sequence as input and outputs well-formed UTF-8. All UTF-8 sequences from the input are copied unmodified. All other bytes are assumed to be encoded in ...
5
votes
0answers
162 views

Easy bitset IO v2

In a previous question I posted a method for easy std::bitset IO on a bit-for-bit basis. This question was later followed up in another solution. Both of these ...
4
votes
0answers
84 views

Implement a readN() from read7()

Exercise: Using a read7() method that returns 7 characters from a file, implement readN(n) which reads n characters. ...
4
votes
0answers
69 views

Perl PasteBin scraper

I'd like to optimize my code and get a better of understanding of how I can perform the task I am doing better. I've only used Perl threads about 3 or 4 times now. The purpose of my script / code ...
4
votes
0answers
305 views

Error handling with C-string input using get() and getline()

I've just learned the basics of c-strings and how to read line oriented input. I noticed that fail bits are set for each function. However, not every problem sends a fail bit, so I thought this would ...
4
votes
0answers
790 views

subprocess with logging module: tee with StringIO

I've got a long-running process. Once it finishes I need the output. But the user should be informed while it's running. With the logging module I get timestamps ...
3
votes
0answers
65 views

One interface for multiple CRUD resources

I asked about an abstraction layer for accessing files (link) a couple of days ago (I decided to not call it a follow-up anymore as there are too many changes). I tried to incorporate many of the ...
3
votes
0answers
158 views

K&R Exercise 1-13. Printing histogram of word lengths (vertical variant)

I'm going through the K&R book (2nd edition, ANSI C ver.) and want to get the most from it. How does the following solution look to you? Note that, for the sake of exercise, I don't want to use ...
3
votes
0answers
185 views

Reading log file of subprocess

I run subprocesses with lot of output (compilation of Unity 3D projects). I use log parsers to find known issues. ...
3
votes
0answers
70 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,...
3
votes
1answer
149 views

Reading from and writing to a file without passing around filename

I was looking for a way to write to and then read from a file in different parts of my code, without passing the filename around and without consumers needing to know it was coming from a file. I ...
3
votes
0answers
58 views

URL fetcher and parser for XML feeds

Here is a program that will parse and print XML feed URLs. I want to reuse most of it to add post date to each link. This adds a new concern of CLI and output formatting on top of parsing and (poor) ...
3
votes
0answers
319 views

Functionally Typed I/O Streams

I thought up a function that provides types with InputStream and OutputStream: ...
2
votes
0answers
37 views

Class which encapsulates related socket streams

I have a class which encapsulates stream related objects, and I have provided the method API for doing basic manipulation on the stream read/write/close, but is this a good approach? The only benefit ...
2
votes
0answers
422 views

Golang nanny process starting child process

The idea here is that my executable can be started normally (in which case it runs my business logic), or it can be wrapped in a nanny process (which starts a child process to run the business logic, ...
2
votes
0answers
3k 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 ...
2
votes
0answers
57 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 along ...
2
votes
0answers
89 views

Write to terminal and buffer

...
1
vote
0answers
38 views

Prompting the user to input a data value into an element in a linked list

I'm working through a practice problem that is having me build and modify a linked list over a series of steps. I am particularly interested in knowing if there's a more elegant way of prompting the ...
1
vote
0answers
85 views

Echo in Prolog with single print (new version)

In order to learn a bit more of Prolog, I implemented the echo command for SWI-Prolog. I want a correct implementation, that is, it satisfies the following requirements: It makes only one I/O call ...
1
vote
0answers
31 views

Download the contents of an HttpURLConnection while generating metadata

Working on a web crawler (again), except now I've had a lot more time to hone my skills. The largest bottleneck in my program, as is to be expected, is the actual downloading of the data, so I'd love ...
1
vote
0answers
162 views

Customized streambuffer for C++ istream

Basically I implement a traditional file-descriptor-based streambuffer for istream operations. The implementation overrides the ...
1
vote
0answers
73 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 ...
1
vote
1answer
78 views

Downloading and reading data in go

I am trying to experiment with golang. This code spins off two Go routines: one to download data and another to read from the body. Both go threads are synced by the data channel. I have two ...
0
votes
0answers
21 views

Go wrapper around io.Writer that tracks the number of bytes written

The code below implements ProgressWriter, a wrapper around io.Writer that can track the number of bytes written, and a function <...