General FreeBASIC programming questions.
-
Oceano
- Posts: 43
- Joined: Jun 05, 2009 20:37
-
Contact:
Post
by Oceano »
Hello fiends,
Anyone know how to do this correctly?:
Code: Select all
Dim x as String
x = "c:\documents and settings\AEIOU\1234\Test.txt"
Shell "copy " & x & " Cache.txt"
I've seen in google is done with double quotes, but do not understand the logic. I have tried in many ways, but I can not make it work.
Thank you!
-
MOD
- Posts: 555
- Joined: Jun 11, 2009 20:15
Post
by MOD »
If your path uses spaces, you have to put quotes around it. Try this:
Code: Select all
x = """c:\documents and settings\AEIOU\1234\Test.txt"""
-
Oceano
- Posts: 43
- Joined: Jun 05, 2009 20:37
-
Contact:
Post
by Oceano »
The compiler says:
warning 13(0): Missing closing quote in literal string
And the message in progress:
The system can not find the file specified.
Thanks for answering! But in this case is not so.
Last edited by
Oceano on Oct 22, 2011 22:36, edited 1 time in total.
-
MOD
- Posts: 555
- Joined: Jun 11, 2009 20:15
Post
by MOD »
This is a compiler warning, you have forgotten some quotes. have a cose look at the code, it's three quotes on both sides.
This works perfect for me:
Code: Select all
Dim x as String
x = """c:\documents and settings\AEIOU\1234\Test.txt"""
Print "copy " & x & " Cache.txt"
Sleep
-
Oceano
- Posts: 43
- Joined: Jun 05, 2009 20:37
-
Contact:
Post
by Oceano »
The command "Print" does well, but the command "Shell" does not work. Thanks for answering!
-
MOD
- Posts: 555
- Joined: Jun 11, 2009 20:15
Post
by MOD »
Same result for Shell... it simply works as expected. Maybe you're using a old version of the compiler. The latest version is 0.23.
-
Oceano
- Posts: 43
- Joined: Jun 05, 2009 20:37
-
Contact:
Post
by Oceano »
You're right MOD. Thank you!
-
Cherry
- Posts: 358
- Joined: Oct 23, 2007 12:06
- Location: Austria
-
Contact:
Post
by Cherry »
Also, instead of Shell("copy ....."), you might consider using FreeBasic's FileCopy function.
-
Oceano
- Posts: 43
- Joined: Jun 05, 2009 20:37
-
Contact:
Post
by Oceano »
Thanks for the advice, Cherry. Your idea is good.