I was trying to read photon spectrum from a text file. The program works perfectly when I am using spectrum2.txt but if I use spectrum.txt, the input is not running and these errors are shown in log file.
spectrum.txt (138 Bytes)
spectrum.txt (402 Bytes)
source.f (12.3 KB)
Is there any particular format that I have to follow in the text file ?
Thanks and regards,
the spectrum file – which you have a problem with – has some non-printable characters at the end of the lines, making it impossible to successfully read the file.
Dear @horvathd , can you please tell me how to visualize that ? Because I am unable to see if there is any hidden non printable character is present.
In Linux you can print the non-printable characters with:
cat -v spectrum.txt
This will show you two non printable characters in your spectrum file:
^M: this represents the “carriage return” character, which is used in Windows before a new line. Having this character is not a problem.
M-BM- : this is a character of a “non-breaking space”. This character cannot be read correctly with the Fortran code, and has to be removed. To do so, just open the spectrum file in a text editor, and remove the spaces at the end of each line.
Thank you so much @horvathd , it is solved now.