hey,
I'm re-writing a program i made,
now i want to put a function into a header file, zo far so good, bt how do i work with arguments in this way:
and the header fileCode:*** main.c *** #include "lib.h" #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { // roep de check_for_error functie aan uit lib.h check_for_error); // roep de check_hosts functie aan uit lib.h check_hosts(); // roep de functie check_files aan uit lib.h check_files(); return 0; }
well as you can see i want to check parameters given to the program but i get this error:Code:#include <stdlib.h> #include <stdio.h> int check_for_error(int argc, char *argv[]) { // kijk of er een boodschap meegestuurd word if (argv[1] == NULL) { printf("Geef een boodschap om over te sturen.\n"); } printf("ERROR CHECKING ROUTINE\n"); return 0; } int check_hosts() { printf("HOST CHECKING ROUTINE\n"); return 0; }
gcc.exe -c main.c -o main.o -I"C:/Program Files/Dev-Cpp/include"
main.c: In function `main':
main.c:8: too few arguments to function `check_for_error'
make.exe: *** [main.o] Error 1
Execution terminated
anyone some ideas for me?
thanx in advance



LinkBack URL
About LinkBacks




CornedBee