Ok, So i'm trying to read a file and I think its in Binary and I have to add 65 to each character. Am I on the write track, or is something other than binary.
Here is the text in the data file
.-&1 34+ 3(.-2ß(-ß#$"18/3(-&ß+$5$+ß.-$íß'$ß-$73ß.-$ß(2ß ß+(33+$ß,.1$ß"' ++$-&(-&íß,$22 &$í373ß(2ß ß3$73ß%(+$ëß!43ß$ "'ß+$33$1ß(2ß/1(-3$#ß(-ß(32ß 2"((ß-4,$1(" +ß%.1,íß$ #ß(-ß$ "'ß-4,!$1ß -#ß38/$ß" 23ß(3ß 2ß ß"' 1 "3$1íß'$ß1$24+3ß6(++ß!1(-&ß8.4ß3.ß+$5$+ß36.àɾ
line 37 cout << hex << cypherIn[f]+65;
you are printing out an integer value in hexadecimal format.
What you should be doing is printing the character corresponding to that integer.
You do that by casting it from one type to another
examples:
1 2 3 4 5
cout << (char) 65;
cout << char(66);
cout << static_cast<char>(67);
char c = 68; // Assign value to character variable
cout << c;
Output:
ABCD
That's what I did at line 5 in my previous example:
cout << char (ch+65);
(also notice you don't need an array, you can just read in one character at a time and output the converted result).
Also, line 31
inFile.read(cypherIn,sizeof(cypherIn));
That is attempting to read 500 characters from the file. You certainly don't need to attempt to do that 261 times. Just once would probably be more than enough. :)