Ver Mensaje Individual
  #1 (permalink)  
Antiguo 28/11/2012, 14:19
m4rc05
 
Fecha de Ingreso: julio-2009
Mensajes: 36
Antigüedad: 14 años, 10 meses
Puntos: 0
Pregunta No me funciona fseek en C

Tengo problemas con la función fseek, hay veces que no me funciona y no sé porque...

Código C:
Ver original
  1. #include <stdio.h>
  2. int main(){
  3.     FILE * h;
  4.     h=fopen("testseek.txt","wb"); //abrir w
  5.     fseek(h,0L, SEEK_SET); //funciona
  6.     fputs("inicio",h);
  7.     fseek(h,20L, SEEK_END); //funciona
  8.     fputs("final",h);
  9.     fclose(h);         //cerrar
  10.     h=fopen("testseek.txt","a+b"); //abrir a+
  11.     fseek(h,0L, SEEK_SET); //no funciona =(
  12.     fputs("inicio 2",h);
  13.     fclose(h);
  14. fflush(stdin);
  15. return 0;
  16. }

Saludos y gracias de antemano.