[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#175755: fopen does not positions the stream at the end of the file in mode a+



El mié, 08-01-2003 a las 05:10, GOTO Masanori escribió:
> At 07 Jan 2003 23:02:03 +0100,
> Ander wrote:
> > Package: libc6
> > Version: 2.3.1-8
> > Severity: critical
> > 
> > Opening a file with fopen in mode a+ will position the stream at the
> > begining of the file and not at the end.
> > 
> > I am using Debian GNU/Linux testing/unstable, kernel 2.4.19 and libc6
> > 2.3.1-8
> > 
> 
> Send us minimal test program.
> You have to check below test.  You find it works fine.
> 
I have check your test and it works, but check this one:

#include <stdio.h>

int main(void)
{
 	FILE *archivo;
	int pos;

	archivo=fopen("main.c","a+");
	pos=ftell(archivo);
	printf("file pos after opening: %i\n",pos);
	fseek(archivo,0,SEEK_SET);
	pos=ftell(archivo);
	printf("file pos after SEEK_SET: %i\n",pos);
	fseek(archivo,0,SEEK_END);
	pos=ftell(archivo);
	printf("file pos after SEEK_END: %i\n",pos);
	fclose(archivo);

	return 0;
}

-- 

Ander Lozano Pérez
ander1@wanadoo.es
http://perso.wanadoo.es/ander1 - http://diasce.es.gnome.org

Attachment: signature.asc
Description: Esta parte del mensaje esta firmada digitalmente


Reply to: