As the code is written, there's no need to allocate any space at all - just pass argv[1] into fopen. Not that I think that is the main problem with the code but it can't hurt to fix it.