
-----------------------------------
Aange10
Thu Oct 20, 2011 7:52 pm

Max string (255)
-----------------------------------
What is it you are trying to achieve?
I'd like to get input from a user that contains more than 255 characters.


What is the problem you are having?
Turings maximum string size is 255 characters.


Describe what you have tried to solve this problem

Brainstorming. But the biggest thing I run into is, there's no way to check what the client is inputting before they are through (It's not yet input!).



Is this possible to do? If so, what tools would I go about accomplishing this with?

Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
N/A

Please specify what version of Turing you are using
4.1

-----------------------------------
Insectoid
Thu Oct 20, 2011 7:55 pm

RE:Max string (255)
-----------------------------------
Why would you want input that long in the first place? Try breaking it into multiple lines based on a logical event in the input. Something like, perhaps, a space.

-----------------------------------
Aange10
Thu Oct 20, 2011 8:05 pm

Re: RE:Max string (255)
-----------------------------------
Why would you want input that long in the first place?


Because I need to input questions that contain more than 255 characters.

Try breaking it into multiple lines based on a logical event in the input. 

If the client needed to type a question that was 300 characters long, how would I break up his imput before i recieved it? How do i even make him know he's reached the limit?

Something like, perhaps, a space.

What's that suppose to mean

-----------------------------------
2goto1
Thu Oct 20, 2011 8:11 pm

RE:Max string (255)
-----------------------------------
You may have to use getch and read characters in one by one.

-----------------------------------
Aange10
Thu Oct 20, 2011 8:17 pm

RE:Max string (255)
-----------------------------------
So I don't have a way for them to just type in a response longer than 255? And if I do the getch, wont it require them to type like "A 
var T_F1, T_F2, T_F3, T_F4, T_F5 : string
var M_C1, M_C2, M_C3, M_C4, M_C5 : string
var M_C_A1, M_C_A2, M_C_A3, M_C_A4, M_C_A5 : string
var M_C_B1, M_C_B2, M_C_B3, M_C_B4, M_C_B5 : string
var M_C_C1, M_C_C2, M_C_C3, M_C_C4, M_C_C5 : string
var M_C_D1, M_C_D2, M_C_D3, M_C_D4, M_C_D5 : string
var F_B1, F_B2, F_B3, F_B4, F_B5 : string
var name,dates,ws : string
put "Name first & last?"
get name : *
put "Date?"
get dates : *
put "Ws number (i.e 2-2)"
get ws : *
put "What is T/F question 1?"
get T_F1 : *
put "What is T/F question 2?"
get T_F2 : *
put "What is T/F question 3?"
get T_F3 : *
put "What is T/F question 4?"
get T_F4 : *
put "What is T/F question 5?"
get T_F5 : *

cls
put "What is Multiple Choice question 1?"
get M_C1 : *
put "Answer A: "
get M_C_A1 : *
put "Answer B: "
get M_C_B1 : *
put "Answer C: "
get M_C_C1 : *
put "Answer D: "
get M_C_D1 : *

cls
put "What is Multiple Choice question 2?"
get M_C2 : *
put "Answer A: "
get M_C_A2 : *
put "Answer B: "
get M_C_B2 : *
put "Answer C: "
get M_C_C2 : *
put "Answer D: "
get M_C_D2 : *

cls
put "What is Multiple Choice question 3?"
get M_C3 : *
put "Answer A: "
get M_C_A3 : *
put "Answer B: "
get M_C_B3 : *
put "Answer C: "
get M_C_C3 : *
put "Answer D: "
get M_C_D3 : *

cls
put "What is Multiple Choice question 4?"
get M_C4 : *
put "Answer A: "
get M_C_A4 : *
put "Answer B: "
get M_C_B4 : *
put "Answer C: "
get M_C_C4 : *
put "Answer D: "
get M_C_D4 : *

cls
put "What is Multiple Choice question 5?"
get M_C5 : *
put "Answer A: "
get M_C_A5 : *
put "Answer B: "
get M_C_B5 : *
put "Answer C: "
get M_C_C5 : *
put "Answer D: "
get M_C_D5 : *

cls
put "What is Fill In The Blank question 1?"
get F_B1 : *
put "What is Fill In The Blank question 2?"
get F_B2 : *
put "What is Fill In The Blank question 3?"
get F_B3 : *
put "What is Fill In The Blank question 4?"
get F_B4 : *
put "What is Fill In The Blank question 5?"
get F_B5 : *
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
View.Set ("offscreenonly,text")
put name
put "Mrs. Barnes"
put "2nd Hour Computer Literacy"
put "Worksheet ",ws
put dates
put " "
put " "
put "               TRUE/FALSE              " % 4 tabs 

-----------------------------------
Insectoid
Thu Oct 20, 2011 8:25 pm

RE:Max string (255)
-----------------------------------
You'll need getch() I think. get should never be used to input a large string. 

Fortunately, way back in the day (three or four years ago) I wrote a Blackjack program that uses a custom text input mode. I won't explain it (I haven't looked at the code in years) but I'm sure you can figure it out.

It's in this [url=http://compsci.ca/v3/viewtopic.php?t=19361]thread.

I'd explain in detail if I had time, however I don't have time so I can't explain in detail.

-----------------------------------
Aange10
Thu Oct 20, 2011 9:24 pm

RE:Max string (255)
-----------------------------------
Figured it out! ... For future reference:


var line : flexible array  1 .. 1 of string (1) % Input
var line_after : flexible array 1 .. 1 of string % Medium/Output
var misc : int
%Gets input
for i : 1 .. maxint 
    getch(line(i))
    put line(i) ..
    if line(i) = chr(10) then
        exit
    end if
    new line, upper(line) + 1
end for
%Sets Medium/Output upper (line_after)
if round(upper(line) div 255)  255 then
    for i : 1 .. upper(line)
        misc := round((i div 255))
        if misc 