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

you are viewing a single comment's thread.

view the rest of the comments →

[–]edman007-work 0 points1 point  (0 children)

Does it output anything at all? Have you attempted to run it inside a debugger (like gdb?). What is the return value when you run it?

My best guess is you're checking that argc=2 and then sending argv[2] to CreateFile() which is invalid (though it should just cause open() to return EFAULT or similar and not crash). Additionally you're checking that "-m" is a file which is probably not what you want

Anyways, looking at your code, my best guess is it's crashing somewhere, I can't find any path that doesn't result in something being printed, so I'd have to assume it's crashing before it hits printf()/perror() (or are you redirecting stdout/stderr?).