Importing Files in SmartBasic SDK
Importing Files in SmartBasic SDK
My application calls external files (a text file and 2 images). How do I include those files when compiling a SmartBasic app in SDK for Xcode?
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: Importing Files in SmartBasic SDK
Exactly as you include your main program.
Your project in SDK should be an exact replica of your project on your iDevice, including all necessary files.
Your project in SDK should be an exact replica of your project on your iDevice, including all necessary files.
Re: Importing Files in SmartBasic SDK
Im using an input statement to read the contents of a text file into a string variable. I get a message At runtime stating that there is no data to read. Im assuming that is because it is not seeing the text file. Ive tried placing the text file in different directories and have also tried changing the file path in the SmartBasic program text file. All no good. What am i doing wrong?
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: Importing Files in SmartBasic SDK
All you have to do is just copy your files exactly as they are in your smart BASIC to the "Samples" folder of SDK.
If this advice does not help, then please tell me all your files names with their folder names in your sB project.
If this advice does not help, then please tell me all your files names with their folder names in your sB project.
Re: Importing Files in SmartBasic SDK
Here are the filenames in the Samples folder:
GreyGrad.jpeg
Info.txt
Prop Wheel.png
WOP.txt (this is the SmartBasic program file)
All of the above files are in the same "Files" directory in the SmartBasic app.
Here is the error message at runtime:
INPUT without data in file "Info.txt"
FILE "Info.txt" INPUT infotext$
GreyGrad.jpeg
Info.txt
Prop Wheel.png
WOP.txt (this is the SmartBasic program file)
All of the above files are in the same "Files" directory in the SmartBasic app.
Here is the error message at runtime:
INPUT without data in file "Info.txt"
FILE "Info.txt" INPUT infotext$
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: Importing Files in SmartBasic SDK
Then you need to create "Files" directory in the "Samples" directory and put your files there.
And path to your executable file will be: "Files/WOP.txt"
Or you can try it another way.
Put your files in the root directory of smart BASIC and try to run. If you get the same error then your program is coded to run only from "Files" folder. If you get no errors then you need to find out, step by step, what is wrong with your code and why it does not see files, like here viewtopic.php?f=34&t=1304#p7910
And path to your executable file will be: "Files/WOP.txt"
Or you can try it another way.
Put your files in the root directory of smart BASIC and try to run. If you get the same error then your program is coded to run only from "Files" folder. If you get no errors then you need to find out, step by step, what is wrong with your code and why it does not see files, like here viewtopic.php?f=34&t=1304#p7910
Re: Importing Files in SmartBasic SDK
The "Info.txt" is not seen no matter what folder the file is placed in, including the "Files" folder. It does seem to be accepting the two image files, however. I wonder if this is not a file path issue, but something else?
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: Importing Files in SmartBasic SDK
Please tell what you will find.
Re: Importing Files in SmartBasic SDK
I'm stumped. Even when I remove the "FILE "Info.txt" INPUT infotext$" command from the SmartBasic code, the iOS simulator still generates the same error message at runtime!
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: Importing Files in SmartBasic SDK
Seems your app in simulator is outdated.
My quick suggestion can be: delete your app from simulator and try again. Or perform Product > Clean from Xcode menu.
My quick suggestion can be: delete your app from simulator and try again. Or perform Product > Clean from Xcode menu.