Tcl file read write


















Improve this answer. Eric Melski Eric Melski You should upvote and accept the answer to indicate that it solved your problem! I have one more question. Will appreciate if on can answer. Maybe you can start a new question with additional details, rather than using comments this way. Sign up or log in Sign up using Google.

Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. Thus Manpower and manpower are two different identifiers in Tcl. A line containing only whitespace, possibly with a comment, is known as a blank line , and a Tcl interpreter totally ignores it. Whitespace is the term used in Tcl to describe blanks, tabs, newline characters, and comments. Whitespace separates one part of a statement from another and enables the interpreter to identify where one element in a statement, such as puts, ends and the next element begins.

Collectives on Stack Overflow. Learn more. Asked 9 years, 4 months ago. Active 9 years, 4 months ago.

Viewed times. Improve this question. Ruchi Ruchi 3 3 gold badges 14 14 silver badges 25 25 bronze badges. Add a comment. Active Oldest Votes. Its contents are visible only after the file has finished executing. LV Of course, if there is a need to see the file while it is open, just be certain your code invokes flush , which will force the output to the file instead of waiting until there is a large enough chunk of data to force out.

A simple tk example using the text widget is at Text Widget Example. But a file without newline at end of last line is not considered too well-behaved. Since in this example, a plain string is puts 'ed, I'd advocate a newline here. It's different when you save a text widget's content, where a newline after the last line is always guaranteed; there the -nonewline switch is well in place. About the extra newline thing This is the proper behavior, even if it isn't technically required for most things these days.

Unix text editors and tools still enforce it, however. Should it be considered a bug if Tcl behaves this way under Win32? LV This comment puzzles me. I have never seen a requirement for text files to end in blank lines. I have seen a few broken programs which generated an error if the last line in a file didn't end in a newline - but that doesn't create a blank line. And I don't understand the last question - if Tcl behaves which way under Win32?

In situations where output is line buffered default for text , puts -nonewline does not immediately deliver the output. Andreas Kupries. This scheme hides implementation details and therefore allows modifying of file-handling at run-time by adjusting with-open-file. More about this at Emulating closures in Tcl page. Anyone have the know-how to add to this page to cover reading and writing binary data and data from various languages ie interacting with the encoding system?



0コメント

  • 1000 / 1000