A char *
might be
char const c = 'a';
char const * ptr = &c; // char const *
as in your example, but it could also be a string literal
std::string x("some string");
char const * ptr = x.c_str(); // also char const *!!
When you have just the pointer available, how do you decide up to what memory address you read? You need a length:
file.write(x.c_str(), x.length());