#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>

//FILE IO
FILE* f;
FILE* out;

void fileopen() {
  f = fopen("testfile","r+");
}

int filereadint(int pos) {
  int x;
  fseek(f,pos,SEEK_SET);
  fread(&x,sizeof(int),1,f);
  return x;
}

int filereadbyte(int pos) {
  unsigned char x;
  fseek(f,pos,SEEK_SET);
  fread(&x,sizeof(unsigned char),1,f);
  return (unsigned int)x;
}

void fileclose() {
  fclose(f);
}

void outopen() {
  out = fopen("outfile","w+");
}

void outwritebyte(int byte) {
  unsigned char x;
  x = (unsigned char)byte;
  fwrite(&x,sizeof(unsigned char),1,out);
  return;
}

void outclose() {
  fclose(out);
}
//END OF FILE IO





