hi
if you use

rewind( FILE *in);

what you can use for

I/O stream library
ifstream in(ff.txt);

hi
if you use

rewind( FILE *in);

We don't use this...we use

rewind(in);

what you can use for

I/O stream library
ifstream in(ff.txt);

Are you sure about what you are asking...if yes, please make it more clear

rewind() does nothing more than seek to the beginnng of file. In C you can accomplish the same thing with fseek() function. In C++ fstream use seekg(0,ios_base::beg) or seekp(0,ios_base::beg)

Hi
thank you for your reply, you are right I found what I am asking about.leave it.
one thing, if you define a file like this

char filename[20]="hi.txt";
FILE *fp;
	
	/*Open input file*/
	fp = fopen(filename,"r");
	if (fp != NULL)
	{
		 fprintf(stderr,"Could open input file.\n");
	}
	else
	{
		fprintf(stderr,"Could not open input file.\n");
		result = -1;
	}

now fp suppose to carry the filename, am I right?
so if I used

cout << "the file name is "<< fp << endl;

is suppose to print the filename hi.txt , but actually it prints on screen 00478998.
why is that.
it seems a silly question, but I my brain froozen

now fp suppose to carry the filename, am I right?

Wrong. fp is a pointer to a structure that contains information about the file -- that structure does not contain the filename. Look in stdio.h and you can see what that structure contains, although you may not understand the purpose for all structure members.

so if I used

cout << "the file name is "<< fp << endl;

is suppose to print the filename hi.txt , but actually it prints on screen 00478998.
why is that.

Because fp is not a pointer to the filename, but a pointer to FILE structure.

This question has already been answered. Start a new discussion instead.