hello
i'm a little confused .
i know that befoer reading in binary mode from a file using the "read(char* bufer , int syze )" i should alocate inaf memory to store the number of bytes i want to read , but i discaverd that it works iven if i alocate only one byte and then read 10 or 324322 bytes .
the folowing code works in MS visual studio 2008 and dev cpp 4.9
I'd only imagine you would get an access violation if you tried to access an instruction of variable that was over-written by the read function. Otherwise, the function would execute without any problems; this would however leave you open to unexpected behavior (or crashes) in your application at other places in the code.
This is one of the pitfalls of C++, there are no bounds checking on dynamically allocated memory.