Skip to main content
Stack Overflow
  1. About
  2. For Teams
Filter by
Sorted by
Tagged with
1 vote
1 answer
74 views

I'm using VSCode on Ubuntu 24.04.01.The screenshot shows a program that reads and displays the contents of a file. The "my_file.txt" contains the word "Hello". When I run the code ...
Lexus RX's user avatar
0 votes
1 answer
49 views

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 ...
Pepe Cuesta's user avatar
0 votes
1 answer
89 views

bool isIdentical(FILE *file1, FILE *file2) //this fun tell me files is identical or no { // this must have char1 in file1? char c1 = fgetc(file1); // this must have char2 in file2? ...
0 votes
1 answer
63 views

the fgetc function in C should read just on caracter but in this code read more then one caracter . in this code i test the function fseek to move the cursur and get each time the next caracter using ...
0 votes
0 answers
71 views

The code paragraph is as follow: fp_t=fopen(temp_name,"r"); int j=0; do { char ch=fgetc(fp_t); if(feof(fp_t)==0) all[i].note[j]=ch; j++; } while(feof(fp_t)==0); all[i].note[j-2]=...
3 votes
5 answers
174 views

I am not sure about whether I have to cast a character to an unsigned char before being compared to the return of a getc family function. The functions I consider getc family, are getc, fgetc and ...
1 vote
3 answers
115 views

This is what I have so far. The issue is that the "count" variable is not properly adding to itself when it hits a newline or space character. #include <stdio.h> #include <stdlib.h&...
quench's user avatar
  • 13
0 votes
2 answers
99 views

I'm working on my code. If I use scanf instead fgets, It works but I want to use fgets. If I use fgets after I enter number of lines, I need to press enter. How can I fix this problem? Is this normal? ...
Alpiinoo's user avatar
-1 votes
1 answer
100 views

I'm using the following code to print last N lines of one file to the other. #include <iostream> #include <fstream> #include <string> using namespace std; void printLastNLines(...
ubaabd's user avatar
  • 435
1 vote
0 answers
33 views

In my problem I was using fseek() function to read a character from the 4th position. After that I wanted to write a new character after that position where the file pointer is pointing to. As after ...
0 votes
0 answers
118 views

I have a C program running inside a Docker container and calling a function getkey() as below: int getkey() { int ch; struct termios orig_term_attr, new_term_attr; /* set terminal to raw mode */ ...
Jeff Brower's user avatar
0 votes
1 answer
164 views

I would like to understand why I can print the character 'à' with the functions fopen and fgetc when I read a .txt file but I can't assign it to a char variable and print it with the printf function. ...
ouzz's user avatar
  • 21
1 vote
1 answer
140 views

I am trying to take a list of MAC Addresses and Device names from a text file and store them in an array called list; struct list { char ch; char a[2], b[2], c[2], d[2], e[2], f[2], g[2], ...
0 votes
2 answers
60 views

This code contains 3 file handling related functions which read from a file named "mno". But only the 1st called function in the main() is working. If the 1st function of the list is ...
0 votes
0 answers
47 views

fseek(exsist, start, end); while(count < end) { if(feof(exsist)) break; c = fgetc(exsist); printf("%c",c); if(feof(exsist)) break; ++count; ...
Nikki's user avatar
  • 29

15 30 50 per page
1
2 3 4 5
...
20

AltStyle によって変換されたページ (->オリジナル) /