Notice: Constant WP_MEMORY_LIMIT already defined in /home/javawith/public_html/codesjava.com/wp-config.php on line 107

Notice: Constant WP_MAX_MEMORY_LIMIT already defined in /home/javawith/public_html/codesjava.com/wp-config.php on line 108
C rewind() - CodesJava

CodesJava

Easy learning with example program codes

C rewind()


Notice: Undefined variable: footnotelist in /home/javawith/public_html/codesjava.com/wp-content/plugins/latex2html/inc/core.php on line 475

C rewind() function:

To use stream many times, the rewind() function is used in C. This function sets the file pointer at the beginning of the stream.

Syntax:

rewind(FILE *stream)

Example:

#include <stdio.h>  
void main(){  
FILE *f;  
 
f = fopen("file.txt","w+");  
fputs("Hello C..", f);  
fclose(f);  
 
char arr[100];  
f = fopen("file.txt","r");  
printf("%s",fgets(arr,65,f));  
 
rewind(f);
f = fopen("file.txt","r");  
printf("%s",fgets(arr,65,f));
fclose(f);  
}

Output

Hello C..Hello C..
Please follow and like us:
error
Posted in C   








Copyright © 2019 CodesJava DMCA.com Protection Status