Little endien to Big endien

Some of you knows what it is right?
Well, for those who doesn't, Big endien is all natural and beautiful, while little endien is nasty and is a nature disaster...in my opinion xD
In more comprehensive word, Big endien would be normal I.e.: FF3B5A66 would actually be FF3B5A66
But, in revenge, little endien wants to pranks us, he wants to confuse us I.e.: FF3B5A66 would be 665A3BFF, which means, bytes are reversed D:
And I need a code that can take all those byte (four in total, Bytes are two Hexadecimal letters) and transform then into an array of 4 char*?
in other words, I need to flip bytes! (Or digits, or Chars)
Its easy to flip an image, because of course, their are stored into different memory addresses, but what to do when their are stored in one addresses!
I tried doing it myself, but whit no apparent succsess
PLEASE HELP!!!!!
Well, for those who doesn't, Big endien is all natural and beautiful, while little endien is nasty and is a nature disaster...in my opinion xD
In more comprehensive word, Big endien would be normal I.e.: FF3B5A66 would actually be FF3B5A66
But, in revenge, little endien wants to pranks us, he wants to confuse us I.e.: FF3B5A66 would be 665A3BFF, which means, bytes are reversed D:
And I need a code that can take all those byte (four in total, Bytes are two Hexadecimal letters) and transform then into an array of 4 char*?
in other words, I need to flip bytes! (Or digits, or Chars)
Its easy to flip an image, because of course, their are stored into different memory addresses, but what to do when their are stored in one addresses!
I tried doing it myself, but whit no apparent succsess
- Code: Select all
void Little_Big(char*Finput)
{
FILE*output=fopen("data", "w+b");
FILE*input= fopen("data", "r+b");
FILE*FIoutput=fopen("sub_data", "w+b");
FILE*FIinput= fopen("sub_data", "r+b");
char ByteChk[4];
char TempChk[4];
char*Fouput;
fputs(Finput, output);
fgets(&ByteChk[0], 1, input);
fgets(&ByteChk[1], 1, input);
fgets(&ByteChk[2], 1, input);
fgets(&ByteChk[3], 1, input);
TempChk[0]=ByteChk[0];
TempChk[1]=ByteChk[1];
TempChk[2]=ByteChk[2];
TempChk[3]=ByteChk[3];
ByteChk[0]=TempChk[3];
ByteChk[1]=TempChk[2];
ByteChk[2]=TempChk[1];
ByteChk[3]=TempChk[0];
fputs(&ByteChk[0], FIoutput);
fputs(&ByteChk[1], FIoutput);
fputs(&ByteChk[2], FIoutput);
fputs(&ByteChk[3], FIoutput);
fclose(FIoutput);
fgets(Fouput, 4, FIinput);
fclose(output);
fclose(input);
fclose(FIoutput);
fclose(FIinput);
strcpy(text, Fouput);
}
PLEASE HELP!!!!!