J
jan.dostrasil
Hello, I'm new to c - so sorry if this is off topic here, please advice
at least where should i ask...
I have a program in c which is working fine, it reads everything from
pipe, modifies output data a bit and writes to stdout.
When it is executed without parameters, program works fine. But what if
I'd like to pass some extra configuration parameters to my program?
1. c:\> pipetest < file_in > file_out // this works
2. c:\> pipetest /parameter < file_in // also works, writes
file_in and parameters to stdout
3. c:\> pipetest /parameter < file_in > file_out // nothing happens !?
Thanks anyone for kind advice and a nice day to all,
Y.
// pitest.c
#include <stdio.h>
#include <fcntl.h>
#include <io.h>
int main(int argc,char *argv[]) {
int ch,i;
for (i = 1; i < argc; i++) {
printf("%s\n",argv);
}
setmode(fileno(stdin), O_BINARY);
setmode(fileno(stdout), O_BINARY);
ch=getc(stdin);
while (!feof(stdin)) {
putc(ch,stdout);
}
}
// -------
at least where should i ask...
I have a program in c which is working fine, it reads everything from
pipe, modifies output data a bit and writes to stdout.
When it is executed without parameters, program works fine. But what if
I'd like to pass some extra configuration parameters to my program?
1. c:\> pipetest < file_in > file_out // this works
2. c:\> pipetest /parameter < file_in // also works, writes
file_in and parameters to stdout
3. c:\> pipetest /parameter < file_in > file_out // nothing happens !?
Thanks anyone for kind advice and a nice day to all,
Y.
// pitest.c
#include <stdio.h>
#include <fcntl.h>
#include <io.h>
int main(int argc,char *argv[]) {
int ch,i;
for (i = 1; i < argc; i++) {
printf("%s\n",argv);
}
setmode(fileno(stdin), O_BINARY);
setmode(fileno(stdout), O_BINARY);
ch=getc(stdin);
while (!feof(stdin)) {
putc(ch,stdout);
}
}
// -------