Skip to main content
Filter by
Sorted by
Tagged with
1 vote
1 answer
410 views

I am trying to understand how the seek function in python file handling works. The syntax of this function is seek(offset, whence). The parameter 'whence' is like a point of reference with possible ...
Dhanaseelan V's user avatar
2 votes
0 answers
44 views

Quoting from https://learn.microsoft.com/en-us/cpp/c-runtime-library/files-and-streams?view=msvc-170 Before you can perform many of the operations on a file, the file must be opened. Opening a file ...
Sep Roland's user avatar
  • 41.2k
0 votes
1 answer
28 views

f=open("hello.txt","r+") f.read(5) f.write("op") f.close() the text file contains the following text: python my world heellll mine According to me after opening the ...
om bahetra's user avatar
0 votes
0 answers
38 views

I have opened the file in "r+" mode and tried to use fputs to replace old_line (line) with new_line (updated_line) char updated_line[] = "Hello This was ABCD"; fseek(fp, -(strlen(...
Vinay K's user avatar
1 vote
0 answers
45 views

I've created a simple program to write in a text file, and it seems as if it works. I just cannot find where to locate the text file it created in my Xcode project. FILE *fptr; fptr= fopen(&...
Joshua Perez's user avatar
0 votes
1 answer
165 views

im learning at the moment about file pointers,and came across this code which was given as exemple i tried replicating it in visual studio but i keep getting run time errors that are not relevent at ...
omri's user avatar
  • 3
0 votes
0 answers
20 views

So basically i need to declare file pointer in main functions, and use it in multiple sub-functions, file will be opened in sub function. int main(){ FILE *filepointer; ...
D. K.'s user avatar
  • 137
2 votes
2 answers
489 views

I'm learning about file input/output in C. But there is something I don't understand. I was about to print the simple sentence in the [words.txt] using fgets, but it doesn't work. [words.txt] as below:...
y J.'s user avatar
  • 131
1 vote
1 answer
72 views

#include<stdio.h> #include <string.h> #include <windows.h> #define PATH "F:\\c\\projects\\Banking Management System\\data\\" #define F_PWD "pwd.txt" #define ...
Anil's user avatar
  • 15
0 votes
1 answer
2k views

I have a .dat file with two columns, time & channel of audio data. I am trying to just read the column channel, write it in a different .dat file and save it. In the code, I have stored the file ...
Margi's user avatar
  • 13
0 votes
1 answer
396 views

I am trying to extract records from a text file named lib.txt. My program is a very simple library based management program where I will have to print all books by a given publisher or department. My ...
Surya Majumder's user avatar
0 votes
1 answer
725 views

This is a function that use a set of predefined code to encode input file (infp) to output file (outfp) (in normal text mode) void encode( char *codes[], FILE *infp, FILE *outfp) { while (infp) { ...
패딩즈LYC's user avatar
1 vote
1 answer
585 views

The Goal Have unbuffered I/O and disabled kernel page cache for a legacy C++11 program. This feature must be on demand (through an executable parameter). The idea is to reduce the memory overhead of I/...
A. Gille's user avatar
  • 1,078
0 votes
0 answers
21 views

I am a bit confused about how to modify my code to return a buffer that stores multiple lines of a file as a string and not just the first line. char * readFile ( char * filename){ char text[500]; ...
user avatar
0 votes
1 answer
362 views

I have two scripts: one of them writes the value of a variable to a file. In another script, I try to read it. It is written without problems, but it is not readable. Here I write to a file: $peer_id=...
Сергей's user avatar
0 votes
1 answer
48 views

If I am recursively searching directories and entering all sub-directories, how can I handle not depth exceeding not enough file pointers being available and exit the program (without segmentation ...
shurup's user avatar
  • 901
1 vote
2 answers
466 views

I am using this program to modify every vowel in text.txt to become the hashtag ('#') #include <fstream> #include <iostream> int main() { std::fstream iofile{ "text.txt", ...
cuong.pq's user avatar
  • 157
0 votes
0 answers
388 views

My overall objective (motivation for the question): To provide an executable ìo, from C/C++ compilation/linking, so that a user can execute it alternatively as: io 3> myout.txt. In this case myout....
sancho.s ReinstateMonicaCellio's user avatar
0 votes
1 answer
964 views

here's the code i wrote: #include <stdio.h> #include <stdlib.h> void Print_File(FILE *f) { fopen("f", "r"); char s = fgetc(f); while (s != EOF) { printf("%c", s);...
Musical_Ant's user avatar
1 vote
2 answers
1k views

For a given file pointer (FILE *), is it possible to rapidly determine the distance from current position to the end of file. The time it takes to figure out the actual distance should be not ...
Audra Jacot's user avatar
0 votes
0 answers
175 views

I am trying to use dup2 to communicate between parent and child in the following code. #include <stdio.h> #include <unistd.h> void main(int argv, char *argc) { int testpipe[2]; ...
Marine Biologist Kujo's user avatar
0 votes
1 answer
646 views

Below is a sequence that is repeated multiple times in the file that I will be reading using TCL. Startpoint: FF1 (rising edge-triggered flip-flop clocked by Clk) Endpoint: FF2 (rising edge-triggered ...
user avatar
1 vote
0 answers
60 views

I want to make simple login,register system. and register part is done, but login part is little confuse.. Login with Txt file. Filename - ID, file including "Nickname|PW" then scanf ID first, if id ...
Pican's user avatar
  • 11
1 vote
0 answers
85 views

I have a file test.txt, which contains two lines. 123456789 abcdefghi And here is a C code. FILE* fp; char str[20]; fp = fopen("test.txt", "r"); printf("%d", ftell(fp)); // 0 ...
anonymous's user avatar
-2 votes
1 answer
130 views

I am trying to read data from an input file that contains an integer on the first line ( represents the number of images listed in the file ), a float on the second line( this is used for other ...
user9477548's user avatar