SHARE
TWEET

reading file to struct

a guest May 6th, 2010 131 Never
  1. fread((void *)buffer, sizeof(OBJECT), 1, file);
  2. OBJECT* obj;
  3. obj = (OBJECT*) malloc(sizeof(OBJECT));
  4. obj = (OBJECT*) buffer;
  5. obj->c[obj->a] = '\0';
  6. printf("obj->a = %d\n"
  7.         "obj->f = %d \n"
  8.         "obj->c = %s\n",
  9.         obj->a,
  10.         obj->f,
  11.         obj->c);
RAW Paste Data
Top