'a' - '0'=49, why not
CodePudding user response:
'a' corresponding decimal ASCII is 65 0 x61, namely the '0' ~ '9' corresponding is 0 x30 ~ 0 x39General to '0' - '9' character is poor compared to '0' and do
General is' A '-' Z 'and' A 'poor comparison and do
In the same way, 'a' - 'z' and 'a'
CodePudding user response:
Computer memory or file content or transport it is just a one-dimensional binary byte array and its corresponding binary address;The human brain to a computer memory or file contents or transfer the content of the one-dimensional binary byte array and its corresponding binary address some parts as an integer, number of signed/unsigned number, floating point Numbers, complex Numbers, letters, digits, Chinese/Korean/French... Character/string, assembly instructions, functions, function parameters, heap, stack, arrays, Pointers, array pointer and pointer array, the array of arrays, pointer to pointer, two-dimensional arrays, character lattice, the coordinates of character strokes, black and white binary images and grayscale images, color images, audio, video, fingerprint information, id information...
Recommended WinHex software to check the hard disk or file or original bytes of memory content,
CodePudding user response:
Fyi:# include & lt; stdio.h>
# include & lt; String. H>
The FILE * f;
Char buffer [4096].
Int r, a;
Void HexDump) (char * buf, int len, int addr) {
int i,j,k;
Char binstr [80].
for (i=0; IIf (0==16) (I %) {
Sprintf (binstr, "% x - 08", I + addr);
Sprintf (binstr, "% s % 02 x", binstr, buf (unsigned char) [I]);
} else if (15==16) (I %) {
Sprintf (binstr, "% s % 02 x", binstr, buf (unsigned char) [I]);
Sprintf (binstr, "% s", binstr);
For (j=I - 15; J<=i; J++) {
Sprintf (binstr, "% s % c," binstr, ('! '& lt; Buf [j] & amp; & Buf [j] <='~')? Buf [j] : '. ');
}
Printf (" % s \ n ", binstr);
} else {
Sprintf (binstr, "% s % 02 x", binstr, buf (unsigned char) [I]);
}
}
If (0! 16)=(I %) {
16 k=16 - (I %);
For (j=0; JSprintf (binstr, "% s", binstr);
}
Sprintf (binstr, "% s", binstr);
K=16 - k;
For (j=I - k; JSprintf (binstr, "% s % c," binstr, ('! '& lt; Buf [j] & amp; & Buf [j] <='~')? Buf [j] : '. ');
}
Printf (" % s \ n ", binstr);
}
}
Int main (int arg c, char * * argv) {
If (argc<2) {
Fprintf (stderr, "the Usage: % s filename. Ext \ n", argv [0]).
Return 2;
}
F=fopen (argv [1], "rb");
If (NULL==f) {
Fprintf (stderr, "Can not open the file [% s]! \ n ", argv [1]);
return 1;
}
A=0;
While (1) {
R=fread (buffer, 1409 (6), f);
The HexDump) (buffer, r, a);
A +=r;
If (r<4096) break;
}
The fclose (f);
return 0;
}
CodePudding user response:
char a []="a". Cout & lt;CodePudding user response:
The