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

Filter by
Sorted by
Tagged with
6
votes
3answers
674 views

Conversion into hexadecimal using C++

I want to read a vector of eight bytes, convert them into hexadecimal, store them in a std::string and finally write them into a binary file. I am looking for ...
3
votes
2answers
163 views

Async file copy/move

My effort to write async methods for copy/move a file in C# ...
4
votes
2answers
223 views

Reader for graph-file with ugly return and questionable use of streams

I wrote a class that contains a static method that reads in files from NetworkRepository and converts them into a list of integer-arrays, each representing an edge. The file format from ...
3
votes
0answers
49 views

Simple beginner Rust CLI file reader that prints to stdout

Q: Am I approaching writing idiomatic Rust code correctly? Hi CodeReview, I'm a beginner Rustacean coming from Python going through Rust books (The Rust Book, Rust in Action). A lot of the beginner ...
2
votes
1answer
48 views

RemoteFile in Java - follow-up

(See the first and initial iteration at RemoteFile in Java.) I have added some new facilities for convenience. Now I have this in mind: com.github.coderodde.utils.io.RemoteFileDownloadListener.java: ...
2
votes
0answers
57 views

RemoteFile in Java

(Also, see the next iteration.) I have this tiny class for downloading files from internet: ...
7
votes
2answers
65 views

Skip input to next line, for reading serialized objects

I was de-serializing objects that had an extra newline that needed to be removed before getting the next object. ...
4
votes
1answer
90 views

C functions for fast IO for competitive programming

In some (perhaps not well-designed) competitive programming problems, the runtime and score is dependent on how fast your program can process input. Therefore I've written a small C99 library with ...
3
votes
1answer
91 views

Read file only once

I have a function that returns the contents of a file. Since reading files from disk is expensive, I'd like to avoid having to read the file again after the first read. I've come up with the ...
1
vote
1answer
47 views

Test a single-line file for punctuation and newline [closed]

I have written the following program to read from a file (entire input in single line) and check for: ASCII punctuation characters a final newline ...
0
votes
0answers
69 views

Efficient Timeout for a blocking operation without synchronization

I'm trying to create a timeout for a blocking operation, a InputStream.read() in the specific case, using a timeout thread without synchronization. This is needed ...
12
votes
5answers
6k views

Brute-Force algorithm in C++

I wrote a brute-force algorithm which shall find all possible combinations of ASCII-values that can sum up to a specific value (int hashval). The algorithm is ...
1
vote
1answer
71 views

Keep reading Command-line until you get the word END

I have to write a code which takes (integers) numbers from Command-line and keeps reading the terminal until it gets a word END So I wrote the following; I feel ...
3
votes
0answers
182 views

Python AsyncIO pipeline

I wrote a small snippet to implement asyncio Pipeline - object that connects together Layers, and lets them create and pass ...
5
votes
3answers
132 views

Proper way to find newest file in a directory

I wanted to ask if this is a better way to find a latest file in given directory. This is my current approach: ...
4
votes
0answers
42 views

Molecular .pdb File Reader in Rust

I am new to rust and wanted to get going with a medium-sized project to help learn. I've settled on creating some basic quantum mechanics code which starts with this bare-bones file reader. It takes a ...
9
votes
2answers
2k views

Print-based debugging

...
5
votes
2answers
87 views

Display hexadecimal value stored at a register

I read a book about OS development and faced with a simple exercise: write a function that prints a hexadecimal value stored at a register. The program runs as a boot sector. I would really ...
2
votes
0answers
54 views

Implementation of SCPI for control of test instruments

I work with electronics test equipment. I like to be able to automate tests using their remote control interfaces. I have built a pattern, a few base classes, that I can apply to all devices that ...
11
votes
2answers
328 views

Self-inflicted killing utility

If you need to kill the same process that you're in (for testing purposes or whatever) this code will do it. A definitive, quick, unmerciful dead of the current Java program/app. Not a System.exit(0) ...
7
votes
1answer
151 views

Replacing spaces with tabs. Exercise 1-21 in “The C Programming Language”

I'm looking for feedback on the code I came up with for exercise 1-21 in "The C Programming Language" by K&R. Write a program entab that replaces strings of blanks with the minimum number of ...
4
votes
1answer
53 views

This program reads from serial port, Saves this to a text file, increments file name each time it is run

I want to condense it and get rid of any noob programming errors. The code works fine but I know it's not as elegant as it could be and I really want to improve. Your advice would be brilliant! I've ...
8
votes
4answers
756 views

Read string of any length in C

I've written code in C for reading a string of any length, and printing the string. It's one of my first C programs. I posted the program as part of a Stack Overflow question, and received a comment: ...
3
votes
3answers
67 views

Copy a FileInputStream to a file, either as text or as a string of bytes

I have written a small program that reads input from a text file and then writes this output to a text file. The method contains a switch which decides whether to output to the file as text or as a ...
6
votes
3answers
226 views

Function to prompt user for input

The following program calls a function, which prompts the user for input. The function then returns one of three enum constants; INPUT_SUCCESSFUL, ...
7
votes
2answers
112 views

K&R2 solution to exercise 1-18 (discarding trailing whitespace and empty lines)

Recently I have started learning C++ and I decided to learn C along the way to improve my understanding of how computers work. For C I am using "The C Programming Language Book" by Brian Kernighan and ...
0
votes
0answers
164 views

A FIFO ByteStream in python3

I want a FIFO queue for bytes conforming to python IOBase interface. I cannot find such a library available, nor could I produce one via trivial combinations of existiing libraries: ...
0
votes
0answers
77 views

F# and UDP server/client

I have a simple UDP client/server code looke like: ...
1
vote
1answer
74 views

Rust program, which reads, processes, and writes a file

I'm making a small program to benchmark Rust's performance compared to some other languages. The idea I came up with, was to take a file (with the numbers 1 to 10000000 written to it in separate lines)...
2
votes
1answer
68 views

Python Method for Text Input from Project Euler

Method Frequently input for problems is given as a 1D or 2D array in a text file. Have knocked out a method to do so, but believe something shorter, clearer and cheaper can be written: ...
4
votes
1answer
59 views

Reading from a stream but reserving N bytes at the end of stream

What I'd like to do is read data from a stream (like ifstream::read), but reserve N = 4 bytes from being returned. The last 4 bytes of the stream are not part of the data itself, but are metadata. In ...
2
votes
3answers
107 views

Reading words and counting their occurence in Java

I have very typical problem: Given big text file, containing text. The task is to calculate occurence of each word and print this info from most occured to less. Example input: ...
2
votes
1answer
58 views

Searching for matching shares

We're working on some code that involves validating certain UNC paths (specifically looking for things that appear to be subdirectories of other things), and we've gone back and forth on how to best ...
3
votes
1answer
57 views

Print file out 1 character at a time in the terminal - Python

This program opens a file and prints the text out to the terminal 1 character at a time and at a predetermined speed using time.sleep() Simple and maybe, if you ...
6
votes
1answer
104 views

Simple function to create Tokens from user input

I am new to programming in Rust and as an exercise I was making a simple Lottery checker program. It has a simple menu, the user enters a number for the corresponding option such as 'Add a line', '...
2
votes
1answer
68 views

Write input bytes to a file directly in Python3

I am using Python 3.6.1. This program simply allows a user to enter some bytes as a "string" and it writes those bytes to a file as actual bytes in the order provided. ...
1
vote
1answer
78 views

Go command-line tool to do some simple byte manipulation

I have some files containing 16-bit words in big-endian order, and a tool to process them that assumes little-endian order. I therefore need to swap the order of each pair of bytes in my files. This ...
6
votes
2answers
551 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. ...
1
vote
1answer
260 views

Calculate average from .txt file

I have made an exercise where I need to calculate the average per row of a .txt file. (see below) ...
1
vote
1answer
121 views

Program that deletes near duplicate directories and directories that have .ini like files

The program needs to only keep directories that have at least 1 .osu (.ini like) file with certain restrictions in them. It also needs to delete duplicate .osu files. But since duplicate files are ...
1
vote
2answers
93 views

Input class in Java

I'm a newcomer to Java (I primarily do C# ) and I have to say that they have made I/O handling much more difficult than it should have been. I am accustomed to the scenario where when I need keyboard ...
1
vote
0answers
174 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 ...
3
votes
4answers
117 views

Linux wc command in C

I'm working on my implementaion of the linux wc command. I finally have something that is working properly (with no options yet) but i think it needs a lot of "cleaning". I mean, i highly disrespect ...
4
votes
2answers
132 views

/proc/net/tcp results filter and converter

Being unable to easily read the output of /proc/net/tcp I made a small C# console app that modifies the output to be in decimal notation instead of the standard hexadecimal, show the corresponding ...
6
votes
1answer
130 views

Linux cat command in C

I wrote my own implementation of the linux cat command in C for my computer laboratory class. We were asked to replicate its functionality with no options passed as arguments or with just the -b, -n ...
10
votes
0answers
1k 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 ...
5
votes
3answers
484 views

My own getline function for reading strings from files

I am a newbie to C++ and I want to do some cool stuff with it. Here I have implemented my own getline function which reads from a file. so what do you think of this getline function? ...
5
votes
3answers
158 views

K&R C book, Exercise 1-21: Replace tabs with spaces

I'm new to C, just started reading K&R C book, and am working through exercises. This is my solution to 1-21, and as far as I tested it works. Anything that I'm doing wrong, or that it's not ...
1
vote
1answer
182 views

Simple unit test in C of input using freopen

Here is an initial attempt at unit test of user input in C. The thing that feels unusual is the use of freopen to send the test data to stdin. Are there better ways to implement this kind of test? <...
3
votes
2answers
64 views

Implementation of getdelim

Note: I wasn't trying to follow the POSIX getdelim signature exactly. I needed to add the consume argument for a project I'm ...

1
2 3 4 5
9