can you explain in brief what is "r+" mode in a file... i
know that it si used to read and modify rhe existing
content.... but explalanation about the file pointer in "r+"
mode i wann to know???????????

Answers were Sorted based on User's Feedback



can you explain in brief what is "r+" mode in a file... i know that it si used to read an..

Answer / manoj

Mode Type of file Read Write Create Truncate
"r" text yes no no no
"rb" binary yes no no no
"r+" text yes yes no no
"r+b" binary yes yes no no
"rb+" binary yes yes no no
"w" text no yes yes yes
"wb" binary no yes yes yes
"w+" text yes yes yes yes
"w+b" binary yes yes yes yes
"wb+" binary yes yes yes yes
"a" text no yes yes no
"ab" binary no yes yes no
"a+" text yes yes yes no
"a+b" binary no yes yes no
"ab+" binary no yes yes no

Is This Answer Correct ?    2 Yes 0 No

can you explain in brief what is "r+" mode in a file... i know that it si used to read an..

Answer / abdur rab

When a file is opened with update mode ( '+' as the second
or third character in the mode argument), both input and
output may be performed on the associated stream. However,
writes cannot be followed by reads without an intervening
call to fflush or to a file positioning function (fseek,
fsetpos, or rewind), and reads cannot be followed by writes
without an intervening call to a file positioning function.
Since the file position is altered after read or write.

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More C Interview Questions

what is the structure pointer?

0 Answers   Accenture, HCL,


#include<stdio.h> int f(int,int); int main() { printf("%d",f(20,1)); return 0; } int f(int n,int k) { if(n==0) return 0; else if(n%2)return f(n/2,2*k)+k; else return f(n/2,2*k)-k; } how this program is working and generating output as 9....?

1 Answers  


when will be evaluated as true/ if(x==x==x) a) x=1; b) x=0; c) x=-1; d) none

7 Answers   HCL,


Describe static function with its usage?

0 Answers  


Which is not valid in C? 1) class aClass{public:int x;} 2) /* A comment */ 3) char x=12;

7 Answers  






5. What kind of sorting is this: SORT (k,n) 1.[Loop on I Index] repeat thru step2 for i=1,2,........n-1 2.[For each pass,get small value] min=i; repeat for j=i+1 to N do { if K[j]<k[min] min=j; } temp=K[i];K[i]=K[min];K[min]=temp; 3.[Sorted Values will be returned] A)Bubble Sort B)Quick Sort C)Selection Sort D)Merge Sort

2 Answers   Accenture,


Which is best book for data structures in c?

0 Answers  


Describe advantages and disadvantages of the various stock sorting algorithms

1 Answers   Microsoft,


Q. where is the below variables stored ? - volatile, static, register

3 Answers   Bosch,


Write a c program to find, no of occurance of a given word in a file. The word is case sensitive.

2 Answers  


What are the three constants used in c?

0 Answers  


Why is c faster?

0 Answers  


Categories