First, the maximum file size is the limit of the file system, not the limit of the operating system. It will even change for a specific file system based on how the file system was formatted.
As for how you realize that you have reached the limit, your code will most likely throw an exception when this happens, and you can return to the OS error codes.
, darn "" EXT2 - . , , . , , , , .