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
3 votes
2 answers
117 views

K&R Exercise 5-11. Modify the "detab" - to accept a list of tab stops as arguments

So far I have reached chapter 5 of the K&R Book, Edition 2 from which I have been learning C. I spent a few days thinking of a solution to this program. I wrote two or three versions of the same ...
4 votes
2 answers
64 views

generate lottery numbers to store in a text file

I scripted a program in python to generate lottery numbers for user. There are two playing methods: Lotto6aus49: User can choose any 6 numbers out of 49. Eurojackpot: User can choose 5 numbers out of ...
2 votes
1 answer
93 views

K&R Exercise 1.22 - "fold" long input lines

Until recently, I decided to go back to Chapter 1 of the K&R Book, Edition 2, to try to "improve" the code I've already done. I have also made some changes since I was limited to just ...
3 votes
2 answers
110 views

K&R Exercise 4-6. Add commands for handling variables

For the following exercise (Chapter 4, Ex-4.6) of the Book (K&R 2nd Edition): Exercise 4-6. Add commands for handling variables. (It's easy to provide twenty-six variables with single-letter ...
8 votes
3 answers
676 views

K&R Exercise 3-3. Expands shorthand notations (e.g., a-z to abc..xyz, 0-9 to 012..789)

I have been learning C with K&R Book 2nd Ed. So far I have completed quite a few exercises. For the following exercise (Chapter 3, Ex-3.3): Exercise 3-3. Write a function expand(s1, s2) that ...
0 votes
1 answer
32 views

streaming / low memory groupby in julia

I am working on a groupby-aggregation function that will work without RAM overflow issues. Essentially, I want it to run as fast as possible, while not necessarily loading the entire data structure ...
  • 123
4 votes
2 answers
100 views

Game loop using Future.wait_for to check for input

I started writing this game from scratch yesterday, and I wasn't completely new to C++'s future library. I only use the ...
  • 143
3 votes
2 answers
74 views

Re-designing c-style Input Output

Re - designing c-style input output [ btw I use printf() and scanf() in the core ] Reasons for redesigning it :- Needs 2 functions for input output [ namely ...
  • 133
4 votes
1 answer
63 views

improved "tee" utility

We have modified the tee program with your suggestions from the previous pull request. Did I implement well? I would like to optimize the program even more, what ...
  • 199
1 vote
1 answer
243 views

Process a binary file by chunk using a read stream in nodejs

I want to process a file chunk by chunk to prevent memory exhaustion. I need to consume the file using a read stream. When trying it, this implementation seems to work fine. I am asking your expert ...
2 votes
2 answers
116 views

another attempt to implement the tee command

I implemented the tee command from linux. The program implements the -a option Reads standard input until end-of-file, write a ...
  • 199
1 vote
1 answer
62 views

Passwords with C++ Console

I am really, really new to coding in general and especially c++. To get more familiar with c++ I am trying to do a series of projects with c++ console apps. One of my projects is with a database that ...
3 votes
3 answers
103 views

tee: copy standard input to both stdout and a file

I implemented the tee command from linux. The program also handles the -a option for adding text to the end of a file if it ...
  • 199
5 votes
0 answers
131 views

A POSIX getdelim() and getline() implementation for MSVC

Tired of always having problems in reading arbitrary length lines from file under Windows, I tried to write a POSIX getdelim() and ...
4 votes
2 answers
90 views

Read a file format with mixed CSV and non-CSV content

I have a file format that I need to read which contains blocks of CSV data interspersed by non-CSV (or at least, inconsistent CSV) lines. Other than the very first line of the file (which has comma-...
  • 263
1 vote
0 answers
42 views

A Command Line To-Do List (CLI) application written in NodeJS

I wrote this code for myself so I can manage my personal to-do list easier. Considering, I spend most of my time in the terminal, it made sense. I have worked on the project as a way of practising my ...
  • 11
1 vote
1 answer
64 views

C++ intializing and saving mp4 ftyp box struct byte by byte

I'm unsure whether the way I'm performing initialization is recommended, and whether there is a simpler way to save out a struct like the one I'm using. The main points of feedback I'm looking for are ...
3 votes
1 answer
56 views

Quickly read numeric input

Do you have any criticisms or corrections or improvements? I need to read only numbers(and this numbers could be from 0 to 1000000) ...
1 vote
2 answers
105 views

Function that behaves as dup2

I am reading the book Advanced Programming in the UNIX Environment and I have tried to solve the following exercise: Write a function that performs the same actions as ...
  • 449
3 votes
2 answers
130 views

Retry read/write until all bytes are transferred or error occurs

Currently I have a wrapper function for the read/write system calls, the purpose of which is to eliminate partial transfer ...
's user avatar
3 votes
1 answer
192 views

get_line(): An alternative implementation of standard C library's getline() function

get_line(): An alternative implementation of standard C library's getline() function. Syntax: char *get_line(int fd, int *error_num); I know that I can declare/...
's user avatar
6 votes
1 answer
493 views

Decompress tar.gz file in Go

I want to extract tar.gz file and store the contents in the same directory. I got below method which does the job but I wanted to see if there is any way to improve ...
  • 199
5 votes
0 answers
826 views

C# Async FileInfo Extensions (Copy, Move, Delete)

Here is my effort to implement extensions for FileInfo object: ...
  • 151
3 votes
4 answers
476 views

Generate HTML select tag and options using a text file having list of countries

The code below will generate an HTML select tag and options using a text file having list of countries. If the file doesn't exist or contains only empty / white space lines then generate an input box ...
's user avatar
5 votes
1 answer
211 views

Optimized way to save list of files

I would like to optimize the way that I save files. Each second I save lots of strings in different files. What I want to do is bunch up these IO tasks so they happen in bursts, instead of spread out ...
  • 103
4 votes
1 answer
265 views

Iterate through non-empty words from text files

Given a file or directory, create an iterator that returns the non-empty words from the file or from all files recursively in the directory. Only process ".txt" files. Words are sequence of ...
6 votes
3 answers
2k views

Reading 100,000 data files in Python

I need to manipulate data found in multiple data files (~100,000 files). One single data file has ~60,000 rows and looks something like this: ...
1 vote
2 answers
110 views

File reader and writer

I was told that the following code of mine was poorly written. How bad is it? Do you have any recommendations? ...
7 votes
2 answers
307 views

Word wrap with file input & ouput

As this is a very basic word wrap program, it has at least the following 3 limitations :- The file should have a terminating newline. The column number at which the lines are to be wrapped must be ...
2 votes
1 answer
124 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....
  • 143
0 votes
1 answer
48 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
3 answers
720 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 ...
3 votes
3 answers
346 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 ...
  • 258
2 votes
2 answers
2k 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 ...
  • 362
0 votes
2 answers
68 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 ...
  • 333
4 votes
4 answers
1k 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 ...
  • 141
0 votes
1 answer
329 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
1 answer
641 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
1 answer
246 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 ...
2 votes
1 answer
232 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 ...
  • 21
1 vote
1 answer
79 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: ...
  • 9
0 votes
3 answers
202 views

A calculator in C++

I want to make my calculator code shorter. Here is my code: ...
  • 65
4 votes
1 answer
105 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 ...
  • 43
3 votes
2 answers
148 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 ...
  • 33
4 votes
2 answers
425 views

FileParsing in C

So I have a text file filled with old onion links and its incredibly messy: ...
-1 votes
1 answer
323 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 ...
  • 159
5 votes
1 answer
57 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
1 answer
150 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 ...
  • 61
6 votes
3 answers
2k 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 ...
  • 63
3 votes
2 answers
4k views

Async file copy/move

My effort to write async methods for copy/move a file in C# ...
  • 155

1
2 3 4 5
10