Commits

overlord  committed abe0188

2nohead - 2floppy conversion to raw image file (removed proprietary header)

  • Participants

Comments (0)

Files changed (1)

+#include <stdio.h>
+#include <string.h>
+
+int main()
+{
+  char filename1[255];
+  char filename2[255];
+  unsigned int i;
+  FILE *hf1, *hf2;
+  char* newline;
+
+  puts("Hack to take headers off 2file images");
+  puts("(C)2002 Daybo Logic, all rights reserved. http://www.daybologic.co.uk");
+
+  printf("\nEnter original filename: ");
+  fgets(filename1, sizeof(filename1)-1, stdin);
+  printf("\nEnter new filename: ");
+  fgets(filename2, sizeof(filename2)-1, stdin);
+  puts("\n");
+
+  newline = strchr(filename1, '\n');
+  if ( newline ) *newline = '\0';
+  newline = strchr(filename2, '\n');
+  if ( newline ) *newline = '\0';
+
+  printf("Opening %s for input, %s for output\n", filename1, filename2);
+  hf1 = fopen(filename1, "rb");
+  hf2 = fopen(filename2, "wb");
+
+  if ( hf1 && hf2 ) {
+    unsigned char blah;
+    unsigned int offset = 0U;
+    puts("Writing out image");
+    while ( !feof(hf1) ) {
+      if ( fread(&blah, 1, 1, hf1) ) {
+        if ( offset >= 13 ) fwrite(&blah, 1, 1, hf2);
+      }
+      offset++;
+    }
+  }
+  else
+    puts("Error opening files");
+
+  if ( hf1 ) fclose(hf1);
+  if ( hf2 ) fclose(hf2);
+
+  return 0;
+}