+
+
+Word swapBytes(Word w)
+{
+ return ((w & 255) << 8) + (w >> 8);
+}
+
+
+void outputToFile(Program_header_struct *pHeader, FILE* file)
+{
+ Program_header_struct h;
+ memcpy(&h, pHeader, sizeof(Program_header_struct));
+
+ h.startPC = swapBytes(h.startPC);
+ h.h_file_size = swapBytes(h.h_file_size);
+ fwrite(&h, sizeof(Program_header_struct), 1, file);
+}
\ No newline at end of file