newbie: nice text file

Dan Ingalls Dan.Ingalls at disney.com
Wed May 2 17:59:23 UTC 2001


Jeff Shipman <shippy at nmt.edu> asked...
>Also, is there a way
>to "Quick-Save" this file so I don't have to
>type in its filename each time? (It defaults
>to Workspace.text).

Yes.

If you already have saved the file as, eg, 'Mystuff.txt', then execute...

	(FileStream fileNamed: 'Mystuff.txt') edit.

This will give you a text-edit window on that file.  Whenever you type cmd-s or use menu/accept, it will overwrite the contents after a simple confirm. (*)

>Whenever
>I go to Yellow->More->Save Contents to file
>the file that is produced has a bunch of ^M's
>in it instead of carriage returns. So, the code
>doesn't look very pretty. Is this because
>of some DOS formatting or some such? How can
>I alleviate this problem?

I *think* that your ^M's are due to the fact that Squeak uses unadorned CR's instead of CR/LF pairs as a default for line endings.  Moreover, I *think* that if you execute...

	(CrLfFileStream fileNamed: 'Mystuff.txt') edit

It will store all your line endings as CR/LF pairs, and things should look right in all the other weird DOS software.  I don't *know* this because I almost never use DOS or Windows, and I can't check it on my Mac.

Hope this helps

	- Dan

(*) If you know the FileList, you can edit right in the fileList, and you can spawn a window on any file by choosing menu/more.../spawn in the lower pane.






More information about the Squeak-dev mailing list