Computer Science Canada include/import problem |
Author: | davidkey [ Sat Jul 14, 2012 11:10 pm ] | ||
Post subject: | include/import problem | ||
What is it you are trying to achieve? I'm trying to create a 'guest OS' and having problems trying to generate a list of apps for the list What is the problem you are having? the code overwrites over the last app written Describe what you have tried to solve this problem Looked into references
Please specify what version of Turing you are using Turing 4.1 PS: C:/ is not the actual file location, and it most likely doesn't matter |
Author: | evildaddy911 [ Mon Jul 16, 2012 9:25 am ] |
Post subject: | RE:include/import problem |
glancing through, i think that the problem is that you do not use "mod." if you so not use open : GenStream, "C:/Applist.ti", seek, write, mod Turing will delete the contents of C:/Applist.ti before writing anything to it. |
Author: | davidkey [ Mon Jul 16, 2012 3:00 pm ] |
Post subject: | Re: include/import problem |
Thx for that suggestion, but my output is creating: if id = 1 then include "Applet/./core.ti" end if ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????if id = 2 then include "Applet/../core.ti" end if ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????if id = 3 then include "Applet/TEST APP/core.ti" end if ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????if id = 4 then include "Applet/TEST APP 2/core.ti" end if ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? update: i'm using '%' to comment out the symbols but its still annoying to have this created [syntax="turing"] var AppStream : int := Dir.Open ("Applet") var AppTemp : string var AppMax : int := 0 loop AppTemp := Dir.Get (AppStream) exit when AppTemp = "" AppMax := AppMax + 1 put AppMax, ": ", AppTemp end loop Dir.Close (AppStream) AppStream := Dir.Open ("Applet") var Applist : array 1 .. AppMax of string var TEST : array 1 .. AppMax of string for id : 1 .. AppMax Applist (id) := Dir.Get (AppStream) TEST (id) := "if id = " + intstr (id) + " then\n include \"Applet/" + Applist (id) + "/core.ti\"\nend if\n" exit when Applist (id) = "" put TEST (id) end for var GenStream : int open : GenStream, "System/Applist.ti", write write : GenStream, TEST (1) close : GenStream for id : 2 .. AppMax open : GenStream, "System/Applist.ti", seek, write, mod seek : GenStream, * write : GenStream, TEST (id) close : GenStream end for |
: |