Is there a C++ equivalent (or equivalent technique) of Perl's __DATA__ segment?

220 views Asked by At

is anyone aware of a C++ equivalent of Perl's __DATA__ segment? For anyone not familiar with Perl, the __DATA__ segment is an (optional) annotation towards the end of a Perl file; whatever comes after is considered the content of a (virtual) file which can be accessed (read, written) by Perl through the DATA file handle. I'm looking for something similar to use in a C++ program (don't ask, don't tell).

Thanks

1

There are 1 answers

1
Konrad Rudolph On BEST ANSWER

There’s nothing like that in general.

However, the Linux ELF binary format allows the inclusion of data files via the GNU tool objcopy.

On Windows you can use resource files and assign the linker to include those in the executable.

OS X conventionally uses application bundles to achieve a similar effect.