title: fprintf give me a blank file in c
body: <p>I'm trying to store some data from a GPS to a txt file. The problem is that first the .txt file was empty after y stop the program, but know, when I run the code is like it enter to an infinite bucle and doesn't print me data on screen or in .txt file. </p>
  
  <pre><code>char add_aux_XS[50],file_name_XS[256],file_txt_name_XS[256];
  FILE *Ublox_text;
  
  char * txt_file_UB() {
      printf("Name of txt file (include extension txt): \n");
  
      scanf("%s",file_name_UB);
  
      strcpy(add_aux_UB,"/home/debian/Desktop/Comunicacion/gps/");
  
      sprintf(add_UB,"%s%s",add_aux_UB,file_name_UB); 
  
      return add_UB;
  }
  
  main()
  {
      file_txt_UB=txt_file_UB();
      for(i=0;i&lt;256;i++){file_txt_name_UB[i]=*(file_txt_UB+i);}
      Ublox_text=fopen(file_txt_name_UB,"w");
      fprintf(Ublox_text,"\n");
  
      Ublox_UART=Conf_Ublox();
      while(1)
      {
          struct UBLOX_message Read_UB=Reading_UBLOX(Ublox_UART);
          printf("Valid: %c \t lat: %lf \t lon: %lf \t north: %lf \t east: %lf \n",
              Read_UB.valid,Read_UB.lat,Read_UB.lon,Read_UB.north,Read_UB.east);
  
          fprintf(Ublox_text,"%c \t %lf \t %lf \t %lf \t %lf \n",
              Read_UB.valid,Read_UB.lat,Read_UB.lon,Read_UB.north,Read_UB.east); 
      }       
      fclose(Ublox_text);     
      close_Ublox();
  }
  </code></pre>
  
  <p>When I comment the <code>fprintf</code> line, the program is OK and print in screen the sensor values.</p>