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 human, or another information processing system.
16,976
questions
0
votes
0
answers
4
views
Address used by dma is physical or virtual
My question is the address written in dma descriptor is physical address or virtual address
And what is IoMmu and how it's physical to virtual mapping works
0
votes
0
answers
8
views
Back pressure in C#: best practice for inserting fast and tiny streaming data in Postgresql
In situations that there is a lot of tiny size streaming data that would need to be ingested in a database (in my case, Postgresql, but I'd assume the same situation would also be applicable to other ...
0
votes
1
answer
32
views
c# byte[] asspan equivalent?
I have a line of code with an AsSpan method that didn't exist in .NET 4.7.2.
This is from a netstandard2.1 project that I neither understand nor can convert to .NET 4.7.2.
I found out that the "...
0
votes
0
answers
23
views
print double with variable number of decimals [duplicate]
Sometimes I need double to be printed with 1 decimal (when it has the same value as integer), sometimes I need double to be printed with 6 decimals.
For example:
0.000 should be printed as 0.0
1....
1
vote
0
answers
30
views
Beginner to C Programming - .c file that will operate outside of console / terminal and interact with GUI?
I'm several months into learning C programming and so far have used .c files that always output to the console. Can someone suggest a sample .c file with code that would interact with the GUI? Thanks ...
0
votes
0
answers
24
views
problems with """input().split() in loop""" in python
n, m, k, r = tuple([int(i) for i in input().split()])
roads = []
for road in range(m):
t = tuple(list(map(int, input().split())))
roads.append(t)
print(roads)
My input is this:
6 6 2 6
0 1
...
-1
votes
2
answers
43
views
CPP program background waiting for jobs
I want to split up the following workflow of a C++ program:
Read serialized data (1 sec, which is already very fast for that size)
Search data (0.01 ms)
Return found data(0.00.. ms) Edit: found data ...
-1
votes
0
answers
24
views
How to delete contents from of a file with JAVA? [closed]
I want to delete all information of student by number.
I can read and add new student information to file. But I cannot delete student info from file. How can I solve this problem?
//For example, I ...
0
votes
1
answer
29
views
What is "Polling" in MIPS and how exactly do you "Poll" in Memory Mapped I/O
having trouble warpping my head around this topic, simple internet searches only show Interrupt Handling so im assuming its a type of interrupt? sorry if im being dense.
2
votes
1
answer
121
views
Passing allocatable array into a subroutine
I am working on a f90 code that I didn't write. I am not a very experienced fortran user.
There is a part that bothers me a bit and I am not sure if it is a normal practice. Can someone help me to ...
1
vote
1
answer
36
views
Python: write to file results in truncated output ([ 1. 1.03 1.07... 79.70) ] instead of column of all data
I'm not that experienced in Python.
I want to write a variable called "abc" to a file. It should be a long column of numbers, like:
1.000
1.002
2.7778
...
I can create a file and write ...
-2
votes
0
answers
43
views
how can I display all words from a text file? [closed]
What I have here is a word guessing code that only gets the user to guess one word. If the user guessed it correctly, it ends. So how can I display all the words in the text file? Another side ...
-3
votes
0
answers
37
views
why java stream can write after close? [closed]
I write a piece of code to test what happens if I use a stream after it was closed.
XXXOutputStream baos = new XXXOutputStream();
byte[] a = new byte[] {'a'};
baos.write(a);
baos.close(...
0
votes
1
answer
13
views
Why does reading from an exited PTY process return "Input/output error" in Rust?
I'm attempting to read from a process that's backed by a PTY in Rust, but once all bytes have been read from the process then reading from the process returns an Input/output error instead of the ...
0
votes
3
answers
36
views
Why does the PrintWriter class (and other writers) require a call to flush after writing?
I have noticed that some I/O Classes in Java (and a lot others, like the BufferedWriter and FileWriter), require a call to flush() after writing. (With the exception of AutoFlush, I'll get to that ...
0
votes
0
answers
32
views
The most space efficient way of storing images in memory in Python?
I'm currently working on a image server project in Python and I've been unable to find information on the most efficient way of storing the images in memory. I've tried using sys.getsizeof to try to ...
0
votes
0
answers
6
views
If the offset of `pread` represents the real offset in disk
Random read is usually slower than sequential read. I want to make my program faster, so my question is: do the following two reads mean sequential reads on the disk.
pread(fd, size, offset);
pread(fd,...
1
vote
2
answers
58
views
How can bytes in char array represent integers?
So let's say I have char array that I read from binary file (like ext2 formatted filesystem image file).
Now I need to read integer starting at offset byte 1024(<--that's the offset from start of ...
1
vote
1
answer
21
views
Is it possible to fully delete a TextIOWrapper?
Background
=============
Let's say I'm writing some unit tests, and I want to test the re-opening of a log file (it was corrupted for some reason outside or inside my program). I currently have a ...
0
votes
0
answers
14
views
How to create PyArrow Table from IOBytes stream of a JSON file from s3 bucket
import io
from pyarrow.json import read_json
import boto3
session = boto3.Session(aws_access_key_id=AWS_ACCESS_KEY_ID, aws_secret_access_key=AWS_SECRET_ACCESS_KEY)
s3 = session.resource('s3', ...
0
votes
2
answers
18
views
Given the following snippet, would it be wise to specify the reason of the failure or throw an IOException?
I'm creating a "File Manager" to practice my IO skills. If I'm creating a file, how would I handle an error if file#createNewFile() returns false?
@Override
public void run() {
...
0
votes
1
answer
32
views
How to search a binary file for a signature offset
This is my example so far:
import io
import mmap
import os
import time
# 20 MB test file
filename = "random.bin"
if not os.path.isfile(filename):
with open(filename, "wb") as ...
0
votes
1
answer
25
views
Python3 interpret user input string as raw bytes (e.g. \x41 == "A")
I want to accept user input from the command line using the input() function, and I am expecting that the user provides input like \x41\x42\x43 to input "ABC". The user MUST enter input in ...
0
votes
1
answer
54
views
How to call google vision legacy models?
I want to use the legacy text_detection and document_text_detection model. (refer: https://cloud.google.com/vision/docs/service-announcements)
Im trying it this way using features:
import io
from ...
0
votes
1
answer
20
views
What is the inconsistency in pixels colors?
This program gets the r, g, b, a values of a pixels two ways. One by converting into a 2d array of tuples and reading the values. The other uses the default PIL method. However they give me different ...
1
vote
2
answers
26
views
How to ignore input from `BufferedReader` when using `Thread.sleep()`?
I'm trying to make a simple counter that starts between user inputs (3..., 2..., 1..., Go!).
try (var reader = new BufferedReader(new InputStreamReader(System.in))) {
...
try {
for (...
0
votes
1
answer
28
views
ruby - passing open file object to function as parameter
Why does this not work in Ruby when reading and writing to files?
def write_to_file(a_file)
a_file.puts("hello")
end
a_file = File.new("test.txt", "w")
write_to_file(...
-2
votes
1
answer
24
views
How to make .jar file read database and serialised .txt file?
I'm trying to make an executable .jar file from a program that uses both an SQLite database and a serialized read/write file system for storage inside the program. We are able to make an executable ....
0
votes
0
answers
13
views
Java OptionalDataException using ObjectInputStream.readObject()
The object class I am writing to disk is defined as follows:
public class EntityTableLink implements Index<Id, List<String>>, Serializable
{
private Map<Id, Map<String, List<...
-3
votes
2
answers
32
views
Java try with resources with Reader and Writer on the same file
try (Reader reader = Files.newBufferedReader(path);
Writer writer = Files.newBufferedWriter(path)) {
...
} catch (IOException exception) {
...
}
Can I use Reader and Writer which open ...
-3
votes
0
answers
38
views
Saving image to separate computer [server] via IP address via LAN [duplicate]
How can I achieve this one?
I would like to save the image from my local computer (browse image) to another computer (server) via IP Address on Local Area Network (same network [Client and Server]). ...
0
votes
1
answer
54
views
how to transfer values between threads using I/O streams?
I have a thread that reads data from the console.
I want to write a test on it and the only thing I came up with is to declare another stream that will transmit melons through the I/O streams to the ...
0
votes
0
answers
45
views
.NET Core 3.1 Writing file to network drive
I am trying to get user to upload a document from the web interface and have it stored on the network share *\dfsms\shared\MyProject* , it also saves the entry in a SQL table (path, filetype, content ...
1
vote
0
answers
77
views
What is the process of a letter between text app and terminal?
The essential question is as the title describes. And here I will provide specific scene with necessary info, and some my speculations.
How do keyboard input and text output work? This answer have ...
0
votes
1
answer
23
views
Randomized-offset binary raw disk writes with no caching whatsoever
For my application, I am attempting to determine whether a data backup system missed any writes. I am doing this by writing an incrementing integer counter to a 1GB virtual disk, and to make sure no ...
2
votes
2
answers
70
views
Is it possible to efficiently get a subset of rows from a large fixed-width CSV file?
I have an extremely large fixed-width CSV file (1.3 million rows and 80K columns). It's about 230 GB in size. I need to be able to fetch a subset of those rows. I have a vector of row indices that I ...
0
votes
0
answers
12
views
Why the checkID() function is using bufferReader not a bufferWriter in here?
This is an airline reservation system, so this is the class of the traveler. In this class, we have the function of signing up if the user didn't have an account already. However, in this example, it ...
-1
votes
0
answers
6
views
How to write a program that reads an input file of data in the following format in Python [duplicate]
I want to write a program that reads an input file of data in the following format:
first name1 , last name1 , homework average , test1 , test2
first name2 , last name2 , homework average, test1 , ...
0
votes
0
answers
14
views
Load specific lines of input for training batches
I have a very large csv file with one person's data on each line, and all the dimensions in columns (all binary values). I'd like to load say 60 lines at a time for training, then for the next ...
1
vote
0
answers
36
views
SIGSEGV Segmentation fault when entering wrong file name?
I've been working on a new "dog simulator" app and I've implemented a function to load an existing file containing a dog and its owner (along with a bunch of numbers for age, snack-counter ...
1
vote
1
answer
70
views
Selecting a particular Column in a CSV-file Dynamically
I have this CSV file:
id,name,mark
20203923380,Lisa Hatfield,62
20200705173,Jessica Johnson,59
20205415333,Adam Harper,41
20203326467,Logan Nolan,77
And I'm trying to process it with this code:
try (...
0
votes
0
answers
19
views
in.next()/out.println() blocking the program - scala/java
I am trying out a simple multi-threaded client/server program in scala using the java packages for io.The program waits for something indefinitely both on the client side as well as server side. Not ...
2
votes
1
answer
65
views
Is FileInputStream Really Unbuffered?
FileInputStream uses this native method to read bytes in a user supplied buffer. As we can see in the implementation, a user-space buffer is indeed allocated with length max(BUF_SIZE, supplied buffer ...
1
vote
1
answer
53
views
getchar() keeps returning EOF value when called second time
I have trouble understanding getchar() and EOF.
I was trying to run this code:
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
char c;
int a = 0; //no. of characters
...
-1
votes
1
answer
34
views
Taking input of a string
#include <bits/stdc++.h>
using namespace std;
string solve(string s){
cout << "inside solve";
for(int i=0; i<s.length(); i++){
int occur=0;
while(i+1 &...
0
votes
0
answers
13
views
Read binary values from Input in Unity Pro XL
I hope I can get some help, this seems to be a simple problem
I have a Momentum 171CBU98091 CPU attached to a 170ADM19030, and I am trying to read some binary inputs into Unity Pro XL; I don't have ...
0
votes
2
answers
108
views
How to read from a file and parse it
I have a file .txt containing some values formatted like this:
0,30,25,10
Now, I open up the file and store it into an array
char imposta_tratt[300];
FILE *fp;
fp = fopen("/home/pi/Documents/...
0
votes
0
answers
29
views
How can I read a binary file and display it in JTable?
How can I read a binary file and display it in a JTable?
From the code that saves the file like this in Java:
private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) {
int returnVal = ...
0
votes
1
answer
130
views
How to break for loop at the end of a line
Task at hand here is to create a dictionary using specified inputs.
First element is key and following elements are values.
Input:
name, George Mason
pa, 100.0, 100.0, 95.0, 95.0, 97.0
lab, 100.0, 100....
0
votes
0
answers
7
views
Children vs parent output in iozone
I'm failing to understand what iozone benchmark outputs.
Here I'm launching a basic read with 16 processes, each of them reading a 2048 KiB files all at once.
I've aggressively disabled caching with ...