All pastes #2083201 Raw Edit

dell

public text v1 · immutable
#2083201 ·published 2011-09-27 01:13 UTC
rendered paste body
#include <stdio.h>
#include <stdlib.h>

int main()
{

  long loc;
  FILE *in, *out;
  char ch;

  if((in = fopen("g:/dev-cpp/file1.tloct", "r")) == NULL) {
    printf("Cannot open input file.\n");
    exit(1);
  }
  if((out = fopen("g:/dev-cpp/report.tloct", "w"))==NULL) {
    printf("Cannot open output file.\n");
    exit(1);
  }


  fseek(in, 0L, SEEK_END);

  loc = ftell(in);


  loc = loc-1;
  
  while(loc >= 0L) {
    fseek(in, loc, SEEK_SET);

    ch = fgetc(in);

    fputc(ch, out);
    loc--;
  }

  fclose(in);
  fclose(out);
system( "PAUSE" );
  return 0;
}