Hey guys,
i am wondering, if you load a file in basically any language, how much memory does the file occupy. Like there's the case that usually more memory is used rather than the actual size of the file because the data of the file is mapped to data types for example if a file has 3 numbers that are 1,2 and 3, it will end up being 4 bytes file but if you load them in a program, they will be stored as ints resulting in each being 4 bytes(32 bits), correct?

But um ... what if you load a file say 100 MB size, and you read the content as a string. Is the memory occupied 100 MB as well because maybe everything is represented in the form of chars 1 byte each?

It depends on the computer language you are using. You can specify the size of an integer (16, 32, 64 bits). Also your characters nowadays are unicode and take up more than 1 byte.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.