Page 1 of 2

Importing Files in SmartBasic SDK

Posted: Sun Feb 28, 2016 8:09 pm
by greycheek
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?

Re: Importing Files in SmartBasic SDK

Posted: Sun Feb 28, 2016 8:39 pm
by Mr. Kibernetik
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.

Re: Importing Files in SmartBasic SDK

Posted: Sun Feb 28, 2016 9:52 pm
by greycheek
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?

Re: Importing Files in SmartBasic SDK

Posted: Sun Feb 28, 2016 10:09 pm
by Mr. Kibernetik
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.

Re: Importing Files in SmartBasic SDK

Posted: Sun Feb 28, 2016 11:40 pm
by greycheek
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$

Re: Importing Files in SmartBasic SDK

Posted: Mon Feb 29, 2016 3:12 am
by Mr. Kibernetik
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

Re: Importing Files in SmartBasic SDK

Posted: Mon Feb 29, 2016 1:28 pm
by greycheek
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?

Re: Importing Files in SmartBasic SDK

Posted: Mon Feb 29, 2016 1:29 pm
by Mr. Kibernetik
Please tell what you will find.

Re: Importing Files in SmartBasic SDK

Posted: Wed Mar 02, 2016 1:11 am
by greycheek
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!

Re: Importing Files in SmartBasic SDK

Posted: Wed Mar 02, 2016 1:18 am
by Mr. Kibernetik
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.