I have a C program which gets spawned from a Java program. The C program is mine, while the Java program is third party. The Java program somehow sets things up so that it communicates with my program via stdin/stdout.
The system has been working fine under 32-bit Windows XP for years. I have just purchased a new machine with 64-bit Windows 7. When I ran the Java program (from a "dos" box), it launched my program successfully, and it sent my program a command, which my program successfully acted upon. But when my program went back to its loop with
inputchar = getc(stdin);
the getc(stdin) never returns.
A clue: I know almost nothing about Java and I did have some trouble getting it to run in the first place. It seemed that after installing it from java.com, if I went to a "dos" box and typed "java", I just got an unrecognized command error. I then found a java.exe on windows\sysWOW64 so I typed "windows\sysWOW64 java -jar blah blah..." and then the program looked like it was running (at least up until the getc(stdin) problem).
Any idea what could be going wrong? Do I need a special 64-bit-Windows-7 Java? Is it possible that its just a badly written java program who's bugs only manifest themselves when running on a new OS? Or is it more likely to be me?
EDIT: My C program runs fine on its own (i.e. not spawned from java) on the 64bit windows 7 machine.
EDIT: If I type "\windows\syswow64\java -version", then I get...
java version "1.6.0_18"
Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
Java HotSpot(TM) Client VM (build 16.0-b13, mixed mode, sharing)
EDIT: On the old XP box the java version was 1.6.0_17-b04
EDIT: I did not re-build my C program for the new machine. I just copied the old 32 bit version.
EDIT: the first "command" that the java program sends is a string ending in a "line feed" character (ASCII 10).