All pastes #898205 Raw Edit

Mine

public text v1 · immutable
·published 2008-02-10 04:06 UTC
rendered paste body
int
rf_ini_open (rf_ini * ini, char * path)
{
  char * temp_ptr = malloc (1024);
  buffer_init (&ini->ini_data, 10);
  ini->ini_fp = fopen (path, "r");
  while (fgets (temp_ptr, 1024, ini->ini_fp) != NULL) {
    printf ("\ndata so far: %s", temp_ptr);
    buffer_resize_append (&ini->ini_data, temp_ptr, strlen (temp_ptr));
  }
  printf ("\n\nexited loop\n\n");
  fclose (ini->ini_fp);
  free (temp_ptr);
}

int
main(int argc, char *argv[])
{
  rf_ini my_ini_file;
  rf_ini_open (&my_ini_file, "test.ini");

  printf ("\n\ncontrol returned to main\n\n");  

  printf ("File data: %s", my_ini_file.ini_data.buffer);

  system("PAUSE");	
  return 0;
}