Computer Science Canada

String Data Limit vs. Flexible Array

Author:  Dragon20942 [ Sun Dec 18, 2011 5:47 pm ]
Post subject:  String Data Limit vs. Flexible Array

What is it you are trying to achieve?
I am attempting to file each character (does not matter if spaces are included or not, but I would like to know) of a text file into a separate index of a flexible string array to avoid the max string character limit of 255.


What is the problem you are having?
I cannot isolate each letter of the text file without first creating a variable to take on the value of the entire text file, which could potentially exceed 255 in length.


Describe what you have tried to solve this problem
I tried to use "length" on the text file information (without creating a variable), but could not find the correct syntax, if one exists for that operation.


Post any relevant code

Turing:

loop %this outputs strings separated by spaces, not individual characters
new data, upper (data) + 1
get : stream, data(upper(data))
exit when eof (stream)
end loop


Please specify what version of Turing you are using
4.1.1

Author:  Tony [ Sun Dec 18, 2011 6:03 pm ]
Post subject:  RE:String Data Limit vs. Flexible Array

read the docs got get, it has relevant examples.

Author:  Dragon20942 [ Sun Dec 18, 2011 6:26 pm ]
Post subject:  Re: String Data Limit vs. Flexible Array

Was the intention to lead me to "char"? All I had to do was change my array into chars and it was all solved Very Happy Thanks!

Author:  Tony [ Sun Dec 18, 2011 6:38 pm ]
Post subject:  RE:String Data Limit vs. Flexible Array

that's one way, yes. You could also get content of fixed length, so you could read from a file in blocks of size at most 255. Though either approach works, and there are unique tradeoffs to each.


: