0

I tried to start a exe (jtag console) from a batch file and feed the data from a file to it. This worked well with:

nios2-terminal.exe < test.txt

But there are null chars (0x00) in this file. The chars after the null chars are not passed to the exe, just more zeros, probably because of null terminated strings.

So I splitted the file in 4 files where just the last char is a null and feeded them one after another. The problem is I have to kill the processes, because they wont do it thereself. I need to use the start command.

But I don't know how to feed the file not to the start command but to the exe. This does probably the first:

start /d %path% nios2-terminal.exe < test0.txt
ping 1.1.1.1 -n 1 -w 1 > nul REM// 1ms delay, tried more, too
taskkill /f /im nios2-terminal.exe
start /d %path% nios2-terminal.exe < test1.txt ...

As nios2-terminal.exe puts all chars from stdIn to the jtag of my FPGA, I thougth to use start /b /d %path% nios2-terminal.exe and then read all the files with type testx.txt.

When I do this manualy, I have to press Return first and then the first char I type is put on jtag. In a script I don get this working.

Is ther any other posibility like sending input to the running instance of nios2-terminal.exe or some alternative for the JTAG terminal nios2-terminal.exe, which doesn't mind NULL char inputs.

I hope I didn't missed any threat that allready covers this issue, but I found none.

Thanks a lot

edit:

The title says stdin and stdout redirect because I also want to redirect the output of the program to a file. But I think once I got how to redirect the input with the start command, I can handle this, too.

blubbrezn
  • 11
  • 3
  • Have you tried escaping the redirection character? `start /d %path% nios2-terminal.exe ^< test0.txt` – lit Mar 05 '18 at 01:05
  • Or, use two batch files: `nios2-terminal.exe < %1` which will be executed from a second one with lines:: `start first.bat test0.txt` `start first.bat test1.txt` etc – Jos Mar 05 '18 at 09:00
  • @lit: yes, I tried it but it didn't work. I don't konw why @Jos: Thanks, it worked! One more problem was the delay `ping 1.1.1.1 -n 1 -w 1`, were I needed to put in `-n 2` iterations, otherwise it wouldn't wait for it to finish and the process is killed instantly. – blubbrezn Mar 05 '18 at 11:57

1 Answers1

0

try this:

nios2-terminal.exe > test.txt

and if you want to append use this cmd:

nios2-terminal.exe >> test.txt