| View previous topic :: View next topic |
| Author |
Message |
Filipe_Br Master Cheater
Reputation: 3
Joined: 07 Jan 2016 Posts: 272 Location: My house
|
Posted: Wed Mar 01, 2017 3:57 pm Post subject: Write file on the desktop. |
|
|
In C / C ++ I can do this, but on moon I can not.
I've tried in many ways but always mistake.
| Code: | | FILE = io.open("%USERPROFILE%/Desktop/my_file.txt", "w") |
| Code: | | FILE = io.open("%USERPROFILE%\\Desktop\\my_file.txt", "w") |
| Code: | | FILE = io.open("%%USERPROFILE%%/Desktop/my_file.txt", "w") |
| Code: | | FILE = io.open("%%USERPROFILE%%\\Desktop\\my_file.txt", "w") |
_________________
... |
|
| Back to top |
|
 |
mgr.inz.Player I post too much
Reputation: 222
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Wed Mar 01, 2017 4:07 pm Post subject: |
|
|
| Code: | file = assert(io.open(os.getenv("USERPROFILE")..'\\desktop\\file.txt', 'w'))
file:write('two tea to room two.')
file:close()
|
_________________
|
|
| Back to top |
|
 |
Filipe_Br Master Cheater
Reputation: 3
Joined: 07 Jan 2016 Posts: 272 Location: My house
|
Posted: Wed Mar 01, 2017 4:11 pm Post subject: |
|
|
| mgr.inz.Player wrote: | | Code: | file = assert(io.open(os.getenv("USERPROFILE")..'\\desktop\\file.txt', 'w'))
file:write('two tea to room two.')
file:close()
|
| Thank you, it worked!
_________________
... |
|
| Back to top |
|
 |
|