cannot read text file
3 posts
• Page 1 of 1
cannot read text file
Hello,
Legrand, in Chapter D6.6, deals with reading text files. The instructions to bring helper functions for that purpose into the workspace are as follows:
These commands execute without problems, but the ReadAllText function is not visible thereafter.
The book remarks where the functions are defined: "You will find them in a workspace named Files.dws, delivered with Dyalog APL." However, the Dyalog distribution does not appear to include a workspace with that name. The companion files do contain one, and I presume this is the one that gets loaded.
(This is all in Dyalog 16.)
Grateful for any pointer,
Michael
Legrand, in Chapter D6.6, deals with reading text files. The instructions to bring helper functions for that purpose into the workspace are as follows:
- Code: Select all
)copy files Files
⎕Path ← 'Files'
These commands execute without problems, but the ReadAllText function is not visible thereafter.
The book remarks where the functions are defined: "You will find them in a workspace named Files.dws, delivered with Dyalog APL." However, the Dyalog distribution does not appear to include a workspace with that name. The companion files do contain one, and I presume this is the one that gets loaded.
(This is all in Dyalog 16.)
Grateful for any pointer,
Michael
- haupz
- Posts: 10
- Joined: Mon Jul 02, 2018 7:28 am
Re: cannot read text file
Hi Michael,
The files workspace is in a ws subdirectory of the Dyalog install. This should be on your WS path by default, so you should be able to just )load files like this:
As you can see, there is a system function to read text called ⎕NGET. You may prefer to use that.
Regards,
Vince
The files workspace is in a ws subdirectory of the Dyalog install. This should be on your WS path by default, so you should be able to just )load files like this:
)load files
C:\Program Files\Dyalog\Dyalog APL-64 16.0 Unicode\ws\files.dws saved Sun Dec 3 20:01:28 2017
Files.ReadAllText 'e:\tmp\test.txt'
abc
abc
abc
abc
⎕nget 'e:\tmp\test.txt'
abc
abc
abc
abc
UTF-8-NOBOM 10
As you can see, there is a system function to read text called ⎕NGET. You may prefer to use that.
Regards,
Vince
- Vince|Dyalog
- Posts: 413
- Joined: Wed Oct 01, 2008 9:39 am
Re: cannot read text file
Hi Vince,
I should probably have mentioned that I'm on macOS. The files.dws workspace doesn't seem to be located in the ws directory belonging to the Dyalog distribution.
Is that workspace a Windows-only thing?
Anyway, thanks for the pointer to ⎕nget; I will work with that and look for system functions substituting the other functions Legrand mentions.
Best,
Michael
I should probably have mentioned that I'm on macOS. The files.dws workspace doesn't seem to be located in the ws directory belonging to the Dyalog distribution.
- Code: Select all
ws $ pwd
/Applications/Dyalog-16.0.app/Contents/Resources/Dyalog/ws
ws $ ls
apl2in.dws dfns.dws groups.dws ops.dws smdemo.dws tutor.dws
apl2pcin.dws display.dws isolate.dws quadna.dws smdesign.dws util.dws
buildse.dws eval.dws loaddata.dws rconnect.dws smtutor.dws xfrcode.dws
conga.dws fonts.dws max.dws salt.dws sqapl.dws xlate.dws
ddb.dws ftp.dws min.dws sharpplot.dws tube.dws
Is that workspace a Windows-only thing?
Anyway, thanks for the pointer to ⎕nget; I will work with that and look for system functions substituting the other functions Legrand mentions.
Best,
Michael
- haupz
- Posts: 10
- Joined: Mon Jul 02, 2018 7:28 am
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group