Visualización de archivos de Linux ^ @
Esto también se descubrió por accidente cuando estaba escribiendo el programa, y luego escribí un pequeño programa de prueba para ver qué es esto ^ @:
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <iostream>
#include <unistd.h>
#include <string.h>
using namespace std;
int main() {
int fd = open("test.txt", O_CREAT | O_RDWR, 0777);
const char* str = "hello";
write(fd, str, strlen(str) + 1);
close(fd);
return 0;
}
Luego lo vim
abrimos test.txt
y nos muestra lo siguiente:
hello^@
De hecho, esto ^@
es '\0'
, todos sabemos que hay muchos caracteres invisibles en el código ASCII, para poder distinguir estos caracteres invisibles Linux los codifica nuevamente.