Skip to content
Advertisement

scanf does not work in batch mode programming

I am facing issue in my code it works perfectly fine when I try to execute in linux terminal in interactive mode shown here enter image description here

but when trying to do in batch mode I am getting an unexpected behaviour from program I do not know exactly is it the address like enter image description here

mydata.txt contains 7 2 as values for and b respectively

JavaScript

Advertisement

Answer

I had this problem when using a UTF-8 file with byte order mark (BOM):

JavaScript

I think it would be good for you to do a hex dump on your input file to see if there are any strange characters in it.

Advertisement