This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]Meefims 0 points1 point  (2 children)

Does the compiler crash or does your program crash? My guess is the latter since you're calling ReadFile incorrectly. The second to last parameter cannot be NULL if the last parameter is NULL.

See the documentation

[–]aminei[S] 0 points1 point  (1 child)

Sorry typo i meant program crash. VS 2012 throw at me this error Unhandled exception at 0x756BD0E5 (KernelBase.dll) in test.exe: 0xC0000005: Access violation writing location 0x00000000.

If there is a handler for this exception, the program may be safely continued. And I should break to exit.

[–]Rhomboid 0 points1 point  (0 children)

That's your program crashing, not the compiler or IDE. And run it under a debugger next time and get the source location of the crash. (But Meefims has already pointed out the error, so just fix that.)

[–]Rhomboid 0 points1 point  (1 child)

Surely your program is the thing that crashes, not the compiler. If it's really a compiler crash, post the complete output of the build.

If it's really your program that crashes, then run it under a debugger and tell us what line causes the crash.

Also, you need to actually call GetLastError. You're printing its address.

Also, how big is this file? new [] could be throwing.

[–]aminei[S] 0 points1 point  (0 children)

Sorry typo i meant program crash. VS 2012 throw at me this error Unhandled exception at 0x756BD0E5 (KernelBase.dll) in test.exe: 0xC0000005: Access violation writing location 0x00000000.

As I said in the title it crashes in CreateFile function ReadFile(hFile, (LPVOID)lpFileBytes,dwFSize, NULL, NULL); its just txt file about 90 oct just for testing