Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Can anyone tell me why TCL fails to simply read a specific file? Also the contents of the file fails when doing a string length

The following 2 lines never return and no error is thrown using wish.exe. I have tried in tcl 8.4 and 8.6. File is successfully read with node.

set fp [open "test.lst" r];

set file_data [read $fp];

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Ran out of memory trying to paste the contents of the file so here is a download link to test.lst

https://nextcloud.wardbenn.com/s/znE32yTTaGjm5wL

fconfigure -translation binary -buffersize 10000000;

also fails

>Solution :

When running commands interactively, tclsh and wish will print the result of each command. A read command on a 91MB file produces a lot of output, which can make displaying it very slow. To prevent the printing of the result of a command, add a semicolon and a second command that produces very little output. Then that output will be printed instead:

% set fp [open "test.lst" r]
file6
% set file_data [read $fp];list
% string length $file_data
95513423
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading