All Questions
6,945
questions
1
vote
1
answer
51
views
Why address of the files stored on disk (of vbox vm) are different each time i look at them?
I am aware of ASLR which loads the program at different memory locations each time, however, I am not sure why this is happening in the case of files that I have stored on disk /dev/sda2 of my Linux ...
0
votes
3
answers
83
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
1
answer
39
views
function to return number of characters in n line of a file return always those of line 2 in c
the function is supposed to return the length of a line specified by the 2nd argument
but the result is either 0 or the one in the 2nd line whatever n may be:
int line_length(const char *filename, int ...
3
votes
2
answers
70
views
fwscanf failing to read UTF-8 CSV file correctly in C
This program can only use libraries of the C standard.
I'm trying to read a UTF-8 encoded CSV file in C using fwscanf, but I'm encountering issues with the reading process. The file contains rows with ...
1
vote
1
answer
56
views
File created with fmemopen has no contents after writing
I have some files on disk that I want to read in and concatenate. I don't want to create a new temporary file on disk. So I decided to use fmemopen to read/write to memory and access it using FILE ...
0
votes
0
answers
57
views
Italian Text Frequency Analyzer: Handling Special Characters and Accents
The program works well overall; however, it encounters an issue when it processes accented words. When the program encounters words with accented characters, it stops functioning correctly. The exact ...
0
votes
2
answers
90
views
Issue with writing to a text file in C using printf()
I'm trying to write to a file in C, so quite simple stuff. But I am encountering an issue with the below code:
#include<stdio.h>
#include<stdlib.h>
int main()
{
FILE *fptr;
int ...
0
votes
1
answer
85
views
Got different types of error from a single C program in Linux [closed]
I am working on an embedded Linux (kernel-5.10.24) and now I am running a C program to do a stress testing about file copying. The code is using stdio to read and write file, as follows,
#include <...
0
votes
3
answers
62
views
mmap returns MAP_FAILED trying to write structs in C
I'm trying to develop a FUSE filesystem driver to create a mount point. To make it persistent I figured to save inodes into a binary file. So this is my inode struct:
struct s_fuseInode {
int ...
4
votes
1
answer
222
views
Surprisingly high latency for Rust's `sync_all` on macOS
Context
With the goal in mind to explore the domain of data persistence, I am trying to write a (very) simple networked service:
A client sends some data to a server.
The server writes the data to ...
0
votes
0
answers
52
views
C code loops to infinite instead of breaking at EOF [duplicate]
I am trying to read char-by-char from a file. The code works successfully, however - after it correctly prints all chars in the file, it prints weird diamond characters to infinite.
Here is the code I'...
3
votes
0
answers
81
views
direct io - How to write an odd-sized file using O_DIRECT on Linux
I am experimenting with ways with which I can write odd-sized files i.e., file size not a multiple of block size(512 bytes) using O_DIRECT. Below are two code snippets, one which uses syscalls(open,...
0
votes
0
answers
47
views
program to change volume of an audio file segmentation fault
I am getting a segmentation fault when running the C program with the following code.
// Modifies the volume of an audio file
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h&...
0
votes
1
answer
93
views
what is the maximum bytes can written per file in LITTLEFS file system in ESP32 wroom 32E?
I have ESP32 Wroom 32e controller which having 4MB of flash memory,in that 1.2MB partition for spiff file handling.i want to send sensor datas to server through wifi.when wifi is not available,i need ...
0
votes
1
answer
88
views
I can't get data from a txt file
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <time.h>
#define N 10
#define PI 3.14159265359
int i,j;
double const X0=5,Y0=5,FI=0.7854;//FI in rads
double ...