I think the original question was already answered, if you have a pointer to array or any data at all, it is not possible to find out its length unless it is terminated and very often it is not.

If you need to know size of a file it is asked from operating system using function provided by API, and same program may not work in Linux or other OS. But i don't honestly know specifics on how files are terminated if they are, and what differences there are in NTFS and FAT32 etc...