17,638
questions
0
votes
0
answers
43
views
Best practice and performance for processing binary-file to objects and back
The following code samples are working, so I don't have an actual issue, but hope to get some feedback and suggestions for optimisation and best practices. This question was already asked in ...
0
votes
0
answers
23
views
PHP: Is feof() always required for fread()? [duplicate]
In PHP feof() tests for the end of file, but the documentation says that fread() would stop once the end of file is reached:
fread() reads up to length bytes from the file pointer referenced by
...
-1
votes
0
answers
20
views
Communicating with PC Coms Ports From Web App [duplicate]
I have previously written apps communicating with devices via the Serial Ports but these were Windows Forms and they worked well.
I am now being told that I have to build an app to control a device ...
-4
votes
0
answers
14
views
Disk I/O behind the scenes in modern day systems [closed]
Anyone please explain what is actually happening behind the scenes when I/O is performed from the disk. What does the CPU do ? what does the OS do ? what does the disk do ?
How do all these coordinate ...
0
votes
0
answers
21
views
How to split console output for input and output streams? [duplicate]
My console application contains several objects, each of which runs in a separate Task. All these objects use Microsoft.Extensions.Logging.ILogger to print their state to the console. Through the ...
1
vote
2
answers
48
views
Named Pipes - Buffering and Blocking
Can someone please clarify behavior of the named pipes (particularly in Linux) regarding buffering data and blocking.
mkfifo pipe1
cat pipe1 # blocks until another process sends data
echo "hi&...
0
votes
1
answer
31
views
RabbitMQ IO threads
I was reading .net documentation(https://www.rabbitmq.com/tutorials/tutorial-seven-dotnet) for the RabbitMq.Client library and reached this part
var channel = connection.CreateModel();
channel....
2
votes
1
answer
53
views
Slow read performance when reading volume
I am trying to read an windows volume but for some reason the performance does not match if compared to reading an file located at same volume. In both cases buffering is disabled (enabling it does ...
1
vote
0
answers
42
views
The parameter is incorrect when using iocp to bind conn on Windows
func main() {
conn, connErr := net.Dial("tcp", "127.0.0.1:9527")
if connErr != nil {
fmt.Printf("Failed to dial: %v\n", connErr)
return
}
...
1
vote
1
answer
56
views
How to handle BufReader<File> and BufReader<Stdin> without dynamic dispatch?
I'm trying to create an object that can contain BufReader<File> and BufReader<Stdin> simultaneously. I'd like to avoid the more commonly used "trait object" (i.e. Box<dyn ...
1
vote
1
answer
59
views
Which libc/stdio IO functions Perl uses to open a file?
Which libc/stdio functions does Perl use to open and read a file (e.g. for perl -e 'open(F,"<","test.txt");print(<F>);')?
I tried running this command under strace and it ...
0
votes
0
answers
54
views
Speed-up reading/writing operations from PCIe bus and disk using C++ on Windows
I'm developing a C++ application with GUI (Qt) for reading data from PCIe bus and writing them as binary output file on an NVMe drive. This is my actual code
void SCCCUtilityTool::...
1
vote
0
answers
25
views
Way to pass the Image from a Camera to Java as a BufferedImage on Raspberry Pi 5?
I'm trying to pass the output of an ArduCam Camera connected to a Raspberry Pi 5 running Debian Bookworm to a Java program as a BufferedImage.
I've gotten this to work on Mac Silicon using Sarxos ...
0
votes
0
answers
17
views
BIOS and MMIO Controller
I am trying to understand MMIO in x86 architecture. I read that there is an MMIO controller that converts physical addresses to MMIO or RAM access, and that this chip is configured by the BIOS. My ...
-1
votes
0
answers
87
views
Load and process a file in multi-threads using C++ ifstream, but meet something wrong
I have one file contains many lines, every line is a "info" of one video, and I need to process it. But the file it too large, so using one single thread to load&process it is a bad idea....
1
vote
0
answers
22
views
JavaScript capture data from input field & post it to output field in a multiple row app
I want to input data to a div (column headed 'Result') from an input (columnd headed 'Edit/Update') field using a button (named 'Update') to trigger the event. I can grab the data from the input field ...
1
vote
2
answers
95
views
Reading and writing files in Haskell results in "withFile: resource busy (file is locked)"
I am attempting to make a to-do list cli, and the program can save these tasks to a .txt file entitled tasks.txt, however, when I attempt to add new tasks or view the contents of the .txt file, it ...
0
votes
1
answer
57
views
Asynchronous I/O: Any way to get a report on how many bytes code "thinks" it wrote in an I/O request?
I am trying to write files with a C code using asynchronous I/O (librt and aio.h). The current use case is several threads writing several files simultaneously, but this could change to several ...
0
votes
0
answers
28
views
How Many I/O Operations Are Required to Transfer 20 KB of Data from Disk to RAM?
I’m trying to understand how many I/O operations are needed to transfer data from disk to RAM, given specific parameters.
Consider the following scenario:
Data to Transfer: 20 KB (20,480 bytes) from ...
0
votes
1
answer
91
views
Trying to convert a PDF to a JPEG but I keep facing an error
I'm trying to convert a PDF into a JPEG using python. I'm trying to perform OCR by converting the PDF's into JPEG but keep running into the error:
cannot identify image file <_io.BytesIO object at ...
0
votes
2
answers
99
views
How to increase file I/O and seek operations speed in VB.NET?
I need to read some bytes at known file offset in very big files (gigabytes). Now I am using this:
Using fsSrc As New FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read, MAX_BUFFER)
...
0
votes
0
answers
44
views
Why asynchrounous read/write has less performance than conventioal read/write
In chapter 14-5 of APUE (Asynchrounous I/O), there exist two sample codes. One using conventional read/write and another using asynchrounous read/write (figures 14-20 & 14-21 respectively)
I test ...
0
votes
0
answers
25
views
How to repro kernel writing a dirty page build-up to disk while throttling writes from processes?
Or how to repro a situation where nr_dirty > nr_dirty_threshold?
What parameters can I tweak? From the default:
vm.dirty_background_ratio=10
vm.dirty_ratio=20
I switched to:
vm....
0
votes
1
answer
26
views
In Firebase Analytics Dashboard showing Landing Page as not set
Hello Team,
I am using @react-native-firebase/analytics for capturing analytics in react native android and iOS apps , But on the analytics dashboard I can not see Landing Page analytics. I can see (...
0
votes
1
answer
47
views
Basics of Zig Console I/O
I am trying to figure out if it is possible to use Zig's IO library to read in and print out unbuffered content.
So, I know zig has std.debug.print which handles formatted output in debug execution. ...
0
votes
0
answers
14
views
Socket.io when socket server send msg client socket.on is not trigger
I have implemented one-to-one chat using socket.io-client in React Native. I have two users, and they are messaging each other using the socket.emit event. One user sends a message to the other, but ...
0
votes
0
answers
62
views
System.IO.File.WriteAllText create corrupted file
I'm trying to automate a series of downloads from a website.
I can list the files and eventually download them, but it seems my code creates a corrupted file when saving it.
The filesize is accurate (...
0
votes
0
answers
61
views
How to access an embedded controller registers from a kernel module
I have a platform based on an Intel CPU with a Microchip EC (Embedded Controller) (MEC152x). I'm trying to write a kernel module that access the watchdog timer registers through the EMI (embedded ...
0
votes
2
answers
68
views
Will SEEK_SET SEEK_CUR SEEK_END not be 0,1,2 on any C lib?
For whence parameter of fseek (or lseek in POSIX), some languages that calls C lib assume SEEK_SET, SEEK_CUR, SEEK_END are 0,1,2, respectively, such as gfortran, Nim [^py].
[^py]: while Python's seek ...
1
vote
1
answer
35
views
Using common part of supertrait and subtrait in struct
I am developing an interface that can create connections using TCPStream or SerialPort from this library.
I want to have a member of a struct that implements the traits std::io::Read and std::io::...
0
votes
0
answers
32
views
How does python's open() read mode and read binary mode deal with null bytes and f.seek?
I did 2 experiments
rb mode
r mode
with open("small_file.txt", "w") as f:
f.seek(2)
f.write("Content")
with open("small_file.txt", "rb") as ...
0
votes
3
answers
97
views
Trying to read txt file line by line in C Language
Basically my input file is in the format:
I 15 3 15 10 10 20
S -5 3 15 82
I -20 80 -4 10
S 4 -20 8
The number of ints in a row can vary, but there is always one char at the beginning of each ...
0
votes
0
answers
32
views
At what point in the interrupt-processing path does device-driver code execute?
I am new to interrupt handlers and device i/o and I have a few questions:
When you load a device-driver, i.e. kernel module, its assembly code is stored in the module-mapping region of the Kernel ...
-1
votes
1
answer
30
views
System.IO.Abstraction: Autofac.Core.DependencyResolutionException: 'An error occurred during the activation of a particular registration
Background
I started using the NuGet package System.IO.Abstractions to unit-test File methods (File.Exists(), File.OpenRead(), File.Move(), etc.). I installed the NuGet in both the unit test project ...
0
votes
1
answer
70
views
io.Copy on ssd costs too much time
Recently I developed a simple file upload server using the Go language. The key code is as follows:
func saveFile(r io.Reader, n int64) error {
objectID := "1cb700e18a864328a561641736af934c&...
1
vote
0
answers
56
views
Digital Signal Processing with Gnuradio - output signals differs from input signal without any modification done
I am sorry for the probably pretty basic question (and not very specific title) - still new to DSP and I have no idea what causes my problem.
I am using gnu radio companion and trying to a rather ...
0
votes
0
answers
21
views
do the editor's write rewrite all the bytes on the disk or just the diff?
For example, i'm using neovim and have 200KB file size, when i hit :w to save it, do it gonna rewrite all the bytes in my nvme cells or it will compare the changes and "append" it? I think ...
0
votes
0
answers
36
views
iOS Message Filter Extension network action REST calls not authenticated when Shared Web Credentials set
I’ve created a Message Filter Extension using the ILMessageFilterExtension framework, relying on its network action workflow. However, I've encountered an issue where the stored web credentials are ...
0
votes
0
answers
27
views
Why does fstreams have 1 cursor for both read & write? (Logically and technically) [duplicate]
Consider the next code:
#include <iostream>
#include <fstream>
using std::fstream;
int main()
{
fstream file("text.txt", ios::out| ios::in |ios::trunc| ios::binary);
if (!file)
...
0
votes
1
answer
62
views
How do I Exit a Process if a Child Fails?
The program I'm working with requires a secondary executable to run (for asset compression). For error handling reasons, I need the return value of the child process. According to the system man page,
...
0
votes
1
answer
49
views
How to save numpy Polynomial fit
Given a fitted polynomial using the numpy Polynomial convenience class (>1.14)
p = np.polynomial.Polynomial.fit(...)
what is the best way of saving and loading this fit?
There are three arguments ...
1
vote
1
answer
128
views
How to read a raw disk without locking/dismounting the volume, using Win32 API?
This StackOverflow question has an answer that requires the volume to be locked/dismounted, but it seems this is not necessarily required. When I use the hex editor HxD (Tools > Open disk) to open ...
0
votes
1
answer
111
views
Is it unsafe to use getline() in c to read from stdin?
I know that an incorrect use of scanf() to read user input can lead to undefined behavior and potentially security holes in a program. I've seen many people suggesting that is better to use fgets() ...
2
votes
0
answers
122
views
Why does io_uring read a file so slowly in polling mode?
Problem Summary
I am working on a project that requires using io_uring with polling mode, but now I have encountered two problems:
I need to run it several times before I can output the content; ...
1
vote
1
answer
111
views
How to count the number of bytes read from bufio.Reader in Golang
I open a file and read from it using bufio.Reader like so
file, err := os.Open(filepath)
if err != nil {
return nil, err
}
utf16bom := unicode.UTF16(unicode.LittleEndian, unicode....
0
votes
0
answers
47
views
Finding the real origin of block I/O (submit_bio) using eBPF
I have an I/O tracer which uses eBPF, and traces read and write operations at the different levels of the I/O stack (VFS, File System, Page cache, and Block).
I want to trace a couple of benchmarks (...
0
votes
0
answers
35
views
Interlisp Medley: LITATOM 'streams' no longer supported
I am trying to print string text to file in interlisp medley. Here is the code:
(OUTPUT)
> T
(SETQ OUT (OPENSTREAM 'output.TEDIT 'OUTPUT))
> <Output stream ...>
(OUTPUT OUT)
> T
(PRIN1 '...
0
votes
2
answers
97
views
Write text I/O stream to file with Interlisp Medley
I am tring to write text stream to file in Interlisp, Medley. I have searched everywhere (onine and in the books) but could not find a feasible command for I/O stream file operation in Interlisp.
...
0
votes
1
answer
88
views
Read a file like an array without copying in to an array?
I have ASCII files which are 100 to 400 MBs in size.
I'd like to read them byte-by-byte, as if I was reading an array. So I could access each byte like if (file[pos] == \n) etc.
However, I have ...
0
votes
0
answers
20
views
Python - Cropping a Screenshot with PIL of an object found with Selenium, regardless of monitor size
I am using python and selenium in writing a program to automate a report creation. This program has to be portable and scalable — others will need to be able to use it on their own laptops or desktop ...