在學習STM32 FLASH的時候,讀取地址內容,出現0D, 0A.
在查ASCII表時,發現 OD代表“\r”,即回車,英文是Carriage return;OA代表“\n”,即“換行”(line feed)。
這讓我產生了疑惑:回車和換行不是同一個概念?
經百度發現:https://blog.csdn.net/longforus/article/details/51925285
回車和換行不是同一個東西。
回車:光標返回同行首位
換行:光標移到下一行
爲什麼我們按鍵盤回車鍵時光標會自動移到下一行呢?
因爲它集成了\r\n啊。。。。。
百看不如動手:
編譯環境:LINUX14.05
程序:
#include <stdio.h>
int main(void)
{
printf("test \\r \n");
printf("haha\r");
printf("hello\n");
printf("\ntest \\n \n");
printf("world\n");
printf("^_^");
return 0;
}
運行結果:
sume@gec:/tmp$
sume@gec:/tmp$ ./a
test \r
hello //此處haha已經被hello覆蓋了
test \n
world
^_^sume@gec:/tmp$