Items tagged with filetools

Feed

I do not understand why I am getting permission denied trying to create a file.

restart;
fd := FileTools[Text][Open]("C:\\foo.txt", create=true,overwrite=true);

     Error, (in FileTools:-Text:-Open) permission denied

I am running the above on my PC, from Maple, using the same user which is me. I can ofcourse create a file on my C drive outside of Maple. So I do not understand why it says permission denied. Also tried "C:/foo.txt". Also tried

         fd := FileTools[Text][Open]("C:\\foo.txt", create,overwrite);

Any idea what can be the problem? and how to determine why it is giving this error? I am on windows 7, using Maple 2015.

http://www.maplesoft.com/support/help/maple/view.aspx?path=FileTools%2fText%2fOpen

http://www.maplesoft.com/support/help/maple/view.aspx?path=IO_errors

"permission denied" - An attempt was made to read from a file on which the user does not have
read permissions, or write to a file on which the user does not have write permissions."

Well, I do have write permission to make a file on my C drive !

I tried using fopen, and got same error

restart;
  try     
     fd := fopen("C:\\foo.txt",APPEND,TEXT);
  catch:
     print(`Unable to open file, error is`);
     print(StringTools:-FormatMessage(lastexception[2]));
  end try:

                 Unable to open file, error is
                      "permission denied"

So I have no idea why I keep getting permission denied.

Dear friends.

I need a simple approach for reading a specified line of a text file.

FileTools[Text] module allows to count the lines. By sequential reading of lines it's possible to reach any position in the file. But for large file this takes a lot of time.

FileTools[Position] allows to set/get position in the file, but the position is counted in bytes.

Are there any workarounds for the problem or the use of Database Package is more preferable?

I noticed, that FileTools[Text][ReadLine] cannot read Cyrillic letter "я" in text files.

My test file containes 6 lines (Codepage 1251):

 Николай Петрович ТРУБЛАИНИ
 "ЛАХТАК"
 Ч А С Т Ь П Е Р В А Я
 НЕМОЙ ПАРОХОД  Г л а в а I
 Ветер налетел неожиданно. С неимоверной быстротой запенились волны. Они приближались к пароходу, стоявшему в миле от берега. Между реями мачт и в надстройках...

 

How should I save my result-expression so as to be able to use it directly in other file without having to generate it again.

please help
regards,

I've got the problem of warnings polluting my text outputs.

If I use interface(warnlevel = 0) the warnings are suppressed in the terminal but not in the files exported by the writeto command.

A sample:

> restart;with(CodeGeneration); with(plots); with(ListTools); with(FileTools);
> Matlab(u(1) = 3);
Warning, the function names {u} are not recognized in the target language
cg = u(1) == 3;
> interface(warnlevel = 0); Matlab(u(1) = 3);

Hi everybody,
i'm an italian student, i'd like to create a Maple Library Archive for Maple 11 (a .mla file) with the procedures i want but i don't know how to. Can anyone explain me?

(I want to create a .mla file with some procedures and then recall the library at the initialization of a new worksheet, so that i can use the procedures i defined)


For example, i would like to create a .mla archive with the 2 following procedures:

Page 1 of 1