strings
Print file printable string (print the strings of printable characters in files). Used to search for a string in a binary file, used in conjunction with grep. String length strings command output four or more, or 4, the string no longer than 4 will not be printed, we can -n parameter adjustment, strings -n 2 filename.
Print file printable characters. This file can be a text file (test.c), executable files (test), dynamic link libraries (test.o), static link library (test.a).
Reference: https://blog.csdn.net/stpeace/article/details/46641069
for example
/// @file tmp.cc
#include <cstdio>
namespace zhaolu
{
int hello = 1;
int world = 2;
}
void hello_world()
{
printf("%d\n",zhaolu::hello);
}
int main()
{
int hello;
printf("hello world");
return 0;
}
Use strings:
:strings tmp.cc
#include <cstdio>
namespace zhaolu
int hello = 1;
int world = 2;
void hello_world()
printf("%d\n",zhaolu::hello);
int main()
int hello;
printf("hello world");
return 0;
:strings tmp.cc | grep hello
int hello = 1;
void hello_world()
printf("%d\n",zhaolu::hello);
int hello;
printf("hello world");
Generate an object file:
:gcc -c -o tmp.o tmp.cc
Check with strings:
:strings tmp.o
hello world