[Textual Research] the principle of "hot and hot" and "fake-Copy", and the principle of Textual Research
On the programmer's website, I often see a paragraph (full of tears)
Hand-held two copy, mouth burst hot.
Explain why these two items are not equal to =:
Garbled Chunk:
This is due to the conversion problem between the GBK character set and the Unicode Character Set. There must be some characters in the conversion process of Unicode and the old encoding system, which cannot be expressed by Unicode. Unicode officially uses a placeholder to represent these words, which is: U + fffd replacement character. Then the U + FFFD UTF-8 code out, exactly is '\ xef \ xbf \ xbd '. If '\ xef \ xbf \ xbd' is repeated multiple times, for example, '\ xef \ xbf \ xbd ', then, if it is displayed in the GBK/CP936/GB2312/GB18030 environment, a Chinese character contains two bytes, and the final result is: Weight-weight (0 xEFBF), kg (0 xBDEF ), copy (0 xBFBD ).
Hot and hot garbled code:
On windows, the ms Compiler (that is, the one with vc) in Debug mode fills all uninitialized stack memory into 0xcc, in the string, the heap memory is filled with 0xcd. In the string, the heap memory is changed to 0xcd ". That is to say, there is hot and hot. Check the initialization...
[C ++] How is the running result "tang"
Because you are not correct, the problem lies in this sentence:
{If (a [I]! = NULL) outfile <a [I];}
You can compare the end time of the string, but do not input the end character into array.
Because
When a [I] = NULL, this if statement is not true, so the outfile <a [I] will not be executed, the solution is to use if (a [I-1]! = NULL) to compare
Because a [I] = NULL, there is still a [I-1]! = NULL is true, so this Terminator can be input to array.
The modification is as follows:
# Include <iostream>
# Include <fstream>
Using namespace std;
Int main ()
{
Char a [128] = "Fuck the truth! ";
Cout <a <endl;
Ofstream outfile ("temp.txt", ios: out );
For (int I = 0; I <= 127; I ++)
{
If (a [I-1]! = NULL)
Outfile <a [I];
}
Outfile. close ();
Char B [128];
Ifstream infile ("temp.txt", ios: in );
For (int j = 0; j <= 127; j ++)
{
If (B [j]! = NULL)
Infile> B [j];
}
Cout <B <endl;
Infile. close ();
Return 0;
}
Kylermoss cannot be copied, but miles cannot be robbed.
During the latest shopping festival, you will be able to copy your data, and you will be able to copy your data.
1. >>> U' \ uFFFD '. encode ('utf-8') * 2
2. '\ xef \ xbf \ xbd'
3. >>>
4. >>> printu' \ uFFFD '. encode ('utf-8') * 2