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
2
votes
1answer
43 views

C++ simple type serialization for streaming primitive- / pod types over a web socket (e.g. asio)

I am experimenting with asio web sockets and tried to write a simple serializer / deserializer. I am also thinking about an approach on how to serialize some type information alongside the actual data....
0
votes
1answer
28 views

how to make inputs work well with special characters using the locale.h library? [closed]

for some reason the function setlocale(LC_ALL, "English") doesn't work when using an input function,(getchar, scanf, fgets,..), to get a special character, (Ç, ã, õ, é,...). ...
7
votes
3answers
676 views

Input validation

I am learning C from C Primer Plus, and am still a beginner. I have been introduced to only two functions for input, scanf() and ...
2
votes
3answers
204 views

Efficiently read a file into a (C) string using POSIX APIs

Exactly what the title says, this is a C++ class that attempts to read a file into a null-terminated string as efficiently as possible, using POSIX APIs. Obviously this is not intended to be portable ...
2
votes
2answers
195 views

Filtering FASTQ file based on read names from other file (how to increase performance) Python

I have some code here that basically takes in a list of IDs (sequencing read names) using STDIN, and then filters fin (a gzipped FASTQ file) to just those reads ...
0
votes
2answers
48 views

Getline function

The following is my attempt at writing a getline() function that makes it a bit easier to work with. I suppose an easier way would be to use ...
4
votes
4answers
339 views

Limit fgets input to up to a certain number of characters

This question is an extension of this other question from Stackoverflow. The objective is to limit the input of characters read by fgets to up to a certain number of characters. And in the following ...
0
votes
1answer
104 views

Import XML files to MongoDb with Nodejs

Here is my code which will read XML files and import the data to MongoDb. Do you have any comments on my code? ...
1
vote
1answer
130 views

Read and sort 100 numbers from a text file

The program itself reads 100 values from a text file named input.txt. Then sorts those values in ascending order and writes the values to a new file called ...
5
votes
1answer
85 views

Binary IO inspired by struct pack

About I'm writing a header-only template library for helping with binary IO. It is inspired by pack-d, which is in turn inspired by Python's struct module. I've only finished the output part and ...
1
vote
1answer
82 views

Network Library based on boost::asio

I'm currently trying to develop an easy to use tcp networking library based on boost::asio. This is my first attempt to work with boost asio and therefore I've got some questions: 1.) Firstly, is my ...
1
vote
1answer
75 views

A calculator in C without #include

I made a calculator in C without #include. Now, I want to make my code shorter and better. But I don't know how. Here is my code: ...
1
vote
3answers
192 views

A calculator in C++

I want to make my calculator code shorter. Here is my code: ...
4
votes
1answer
84 views

Processing delimiter characters in C?

Write a C program that will implement the basic operations of table processors. The input will be text data read from a .txt file, operations will be defined using terminal arguments, and the output ...
3
votes
2answers
113 views

NinjaTrader - Writting to MemoryStream then to Disk

I would like to make the below code more efficient by writing all text(CSV) to memory before writing to disk. The CSV file could have upwards of 10,000 or rows. With the current code, it opens and ...
4
votes
2answers
372 views

FileParsing in C

So I have a text file filled with old onion links and its incredibly messy: ...
-1
votes
1answer
116 views

Is performing IO in constructor good idea? [closed]

I have Java (or C#, Python, Kotlin, or other similar language) class that will be used to communicate with client over network. Protocol used by this application allows many different ways to create ...
5
votes
1answer
47 views

A Program that gets text from a client and puts it into a file on a server

I recently created a program that could get information from a client, a name and some text, and then put that into a text file. From there the user can get open the text file straight from the ...
6
votes
1answer
67 views

upload multiple images and resize

I've written PHP code to upload multiple images to a server. This function processes a maximum of 10 images at one time and if any image's width or height is larger than 2000px it will resize it. But ...
6
votes
3answers
1k 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
2k views

Async file copy/move

My effort to write async methods for copy/move a file in C# ...
4
votes
2answers
228 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
57 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
59 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
1answer
195 views

RemoteFile in Java

(Also, see the next iteration.) I have this tiny class for downloading files from internet: ...
7
votes
2answers
72 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
138 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
103 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
53 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
70 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
12k 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
72 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
284 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
248 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
60 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
609 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
66 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
336 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
325 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
54 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
1k 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
70 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
747 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
117 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 ...
1
vote
1answer
87 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
74 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
67 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
109 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
65 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 ...

1
2 3 4 5
10