would someone give me a MPL line that simply writes a line of text to a .txt file? i.e. 'fang-castro is so lazy' > welcome.txt
would someone give me a MPL line that simply writes a line of text to .txt file? i.e. 'fang-castro is so lazy' > welcome.txtI suggest you grab Black Panthers MPL lessons; they are available on 2o
in the RCS Mystic Mods File Area...
If I remember correctly, file handling starts as Lesson 9 and is covered in the next 3 Lessons after that. He explains how to write to
filename.txt first, and then goes on to show both reading, writing and handling text and binary files.
would someone give me a MPL line that simply writes a line of text to
a .txt file? i.e. 'fang-castro is so lazy' > welcome.txt
will it need a
Uses
ANYTHING;
would someone give me a MPL line that simply writes a line of
text to a .txt file? i.e. 'fang-castro is so lazy' > welcome.txt
I suggest you grab Black Panthers MPL lessons; they are available on
2o in the RCS Mystic Mods File Area...
If I remember correctly, you have to OPEN, WRITE and CLOSE a fileThis will assign the filename to the pointer variable. After this, you need to actually open the file using fReWrite, fReset, Append, etc.
using:
fAssign
fWriteThis writes the information to the file. You can also just use WriteLn or Write, with the file pointer variable. ie WriteLn(fptr,'This is some text')
fCloseAlways want to close the file when your done with it. :)
fAssign(fptr,'welcome.txt)
would someone give me a MPL line that simply writes a line of text to a .txt file? i.e. 'fang-castro is so lazy' > welcome.txt
On 27 Oct 2021, fang-castro said the following...
would someone give me a MPL line that simply writes a line of text to .txt file? i.e. 'fang-castro is so lazy' > welcome.txtYou don't need MPL for that, just do a menu option like
Command | (DD) External application
Data | echo "fang-castro is so lazy" > welcome.txt
Job done.
perfect! i UL'd the 20 for Beers color ascii while I was there...
If I remember correctly, you have to OPEN, WRITE and CLOSE a file using:
fAssignThis will assign the filename to the pointer variable. After this, you need to actually open the file using fReWrite, fReset, Append, etc.
fWriteThis writes the information to the file. You can also just use WriteLn or Write, with the file pointer variable. ie WriteLn(fptr,'This is some
fClosetext') Always want to close the file when your done with it. :)
Black Panther
would someone give me a MPL line that simply writes a line of text to a .t file? i.e. 'fang-castro is so lazy' > welcome.txt
This is true! I could even make a shell script to delete the old welcome.txt before writing a new one. Or insert another (DD) command.
This is true! I could even make a shell script to delete the old welcome.txt before writing a new one. Or insert another (DD) command.
You wouldn't need to delete the old file, as the redirection `>` is to replace, not append, so by definition you'll be creating a new file each time.
There is also a read to use command in MPL, called AppendText(). ;)
This is true! I could even make a shell script to delete the old welcome.txt before writing a new one. Or insert another (DD) command.
You wouldn't need to delete the old file, as the redirection `>` is to replace,
You wouldn't need to delete the old file, as the redirection `>` is to replace, not append, so by definition you'll be creating a new file each time.
Var
fptr : File
Begin
fAssign(fptr,'welcome.txt)
fReWrite(fptr) //will recreate the file each time it's run
WriteLn(fptr,'fang-castro is so lazy')
fClose(fptr)
End
Var
fptr : File
Begin
fAssign(fptr,'welcome.txt)
fReWrite(fptr) //will recreate the file each time
it's run
WriteLn(fptr,'fang-castro is so lazy')
fClose(fptr)
End
I had to modify above to below for it work... Keeping me on my toes.
Var
fptr : File
Begin
fAssign(fptr,'welcome.txt',66)
fReWrite(fptr) //will recreate the file each time it's run
fWriteLn(fptr,'fang-castro is so lazy')
fClose(fptr)
End
I had to modify above to below for it work... Keeping me on my toes.
Ah, sorry about that. I've been spending time working in FreePascal lately. ;)
Sysop: | Eric Oulashin |
---|---|
Location: | Beaverton, Oregon, USA |
Users: | 97 |
Nodes: | 16 (0 / 16) |
Uptime: | 03:38:29 |
Calls: | 4,444 |
Calls today: | 5 |
Files: | 8,486 |
Messages: | 348,852 |