Other Shell command that uses '<' as redirect

dds

New Member
Licensed User
Recently I started a project to rewrite an app that uses EPA SCREEN3 on android, and the app was written with a RAD named vb4android, which is written by me a year ago, now basic4android is great in ui design and it has a great power to do all the job, except one, the redirect in a shell command.
before carry on, I have to explain how the model SCREEN works, first of all, I should generate all the command line inputs into an inp file, which exactly contains each line I should input in commandline, and then invoke it with a '<', that is :
data/data/com.screen/screen4a <data/data/com.screen/screen.inp
I used sentences like this to do the job:
cmdShell.Shell(mypath & "/screen4a",Array As String("<data/data/com.screen/screen.inp"),stdout,stderr)
however, b4a program halts when it runs into this line, and in the develop of vb4android, I met the same problem, but when I change the shell command with modifications below, it works.

public String VB4AShell(String cmd) {

String s = "";
String[] cmds = {"sh","-c",cmd};

try {
java.lang.Process p = Runtime.getRuntime().exec(cmds);
BufferedReader in = new BufferedReader(
new InputStreamReader(p.getInputStream()));
String line = null;

while ((line = in.readLine()) != null) {
s += line + "\n";
}

} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
s="Error!";
}
return s;
}

the line String[] cmds = {"sh","-c",cmd} does the trick, and in vb4android, I just use this to enable < redirect:
VB4AShell("data/data/com.screen/screen <data/data/com.screen/screen.inp")

And with all the things above, I decided to try this:
cmdShell.Shell("sh",Array As String("-c",mypath & "/screen4a <data/data/com.screen/screen.inp"),stdout,stderr)

Holly S, it works, at first I want to start this post to ask Erl to modify the Shell function to fix < redirect, but I hope now my discovery can help those who have the same problem as me.
 
Top