mercredi 4 novembre 2015

How to pass a file to an .exe in console

i am currently learning C by reading "The C proggraming Language". I have issues with exercices that implies input and output with getchar()/putchar()/EOF. It seems that the programs made with the exercies are supposed to be used on files. But once i have my .exe i only know how to start the "raw" .exe, i would like to do something like: myProgram.exe file.txt This way the program could read the file as input. Unfortunatly the way i try to do this doesn't work, could you tell me how to do this properly?

Program i want to use on a file:

#include <stdio.h>

    int c;
    while((c = getchar()) != EOF)

Aucun commentaire:

Enregistrer un commentaire