This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

reading file to struct

By: a guest on May 6th, 2010  |  syntax: C Intermediate Language  |  size: 0.24 KB  |  views: 130  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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);
clone this paste RAW Paste Data