file-pointer Questions

3

Solved

I am trying to debug a program that manipulates a file. For example, I set the file-pointer to offset 4 (using a base of 0), but it seems to be starting at offset 5 instead. To try to figure out w...
Watercourse asked 17/7, 2013 at 18:5

6

Solved

I have a C function that reads a stream of characters from a FILE*. How might I create a FILE* from a string in this situation? Edit: I think my original post may have been misleading. I want to...
Lightfingered asked 8/7, 2012 at 8:17

2

These are 2 separate applications. In the first one, I tried to store employee details like name, age and salary in the binary file named emp.bin. In the second application, I tried to view the c...
Civics asked 22/5, 2020 at 14:44

9

Solved

How are file descriptors and file pointers related? When is it appropriate to use each?
Pinnule asked 11/3, 2010 at 9:2

1

Solved

How do I check if two file pointers point to the same file or not. >>> fp1 = open("/data/logs/perf.log", "r") >>> fp1 <open file '/data/logs/perf.log', mode 'r' at 0x7f5adc07c...
Ahasuerus asked 12/9, 2018 at 8:52

4

Solved

I know that pointer is a variable that stores address of another variable. So i understood the concepts of char type pointers, integer type pointers, what happens when we add one to a pointer etc. ...
Jovian asked 5/1, 2014 at 15:33

4

I saw this code somewhere: #include<stdio.h> int main() { FILE * fp; char s[1024]; fp = fopen("file","r"); while( fscanf(fp, "%s", s ) != EOF ) { puts(s); } return 0; } I expect...
Thornberry asked 23/7, 2013 at 5:46

5

Solved

This is the basic code to a program I am writing to practise using files in C. I am trying to detect whether the output file already exists and if it does exist I want to ask the user if they would...
Miler asked 11/12, 2011 at 14:17

2

Possible Duplicate: Getting Filename from file descriptor in C How get fileName having FILE*? Is there any way where I can find the file_name from a file-pointer in C? fp = fopen(fi...
Guib asked 30/3, 2012 at 5:51

3

Solved

Possible Duplicate: What's the difference between a file descriptor and file pointer? If I open file like this: FILE *fp = fopen("mr32.txr","r"); then fp is file pointer or fil...
Romaine asked 19/11, 2011 at 4:28

3

Solved

If a file is opened using the following command: FILE *f1=fopen("test.dat","a+"); The man page reads: a+ Open for reading and appending (writing at end of file). The file is created if it...
Forgave asked 5/9, 2010 at 5:33

1

Solved

Is there a way to do what ftell() does (return the current position in the file) on a raw file descriptor instead of a FILE*? I think there ought to be, since you can seek on a raw file descriptor ...
Bolometer asked 3/8, 2010 at 17:53

3

How can I get the current line position of the file pointer?
Lituus asked 28/3, 2010 at 15:40
1

© 2022 - 2024 — McMap. All rights reserved.