well right now I have an extreamly ugly 'hack' to do it.
I read in the max lines at the top of the txt file, the problem is that that means everytime you change the file you have to update this number and there is just a lot that can go wrong with this aproach.
so lets say this is the test file.
19 <--- maximum amount of lines
3 <--- where the questions start (it's to ensure the numbers aren't print)
3 <--- the amount of lines that need to be opened (to ensure it doesn't open more then it should)
so when the file is opened it opens this
test question 1 <----- sets the search string to this question (when selected)
test question 2 <----- sets the search string to this question (when selected)
exit <--- takes you out of the function (when selected)
when a question is found the
beginning of the lines to be coppyed to the screen and the amount are changed to the amounts needed fore the text box.
now in c++ I have a lot better way to do all this but here I just don't know how. and I know how ugly this is thats why I am requestion a better solution.
function getText()
{
var filehandle;
fileHandle = file_open_read("text/test.txt");
var maxLines = 0;
var lines = 0;
var linesBegining = 0;
maxLines = file_var_read(filehandle);
lines = file_var_read(filehandle);
linesBegining = file_var_read(filehandle);
var k = 0;
k = lines + linesBegining;
//temp.z = 0;
str_cpy(checkString, buffer.string[gid01_choise_value+linesBegining]);
if (fileHandle)
{
temp.x = txt_load(buffer, "text/test.txt");
temp.y = str_len(buffer.string[temp.x -1]);
while(maxLines > k)
{
//str_cpy(text.string[k], buffer.string[k]);
if(checkString == buffer.string[k])
{
lines = file_var_read(filehandle);
linesBegining = file_var_read(filehandle);
break;
}
k +=1;
}
k = linesBegining;
while(k < lines + linesBegining)
{
str_cpy(text.string[k], buffer.string[k]);
k +=1;
}
}
file_close(fileHandle);
}
I also have 2 questions.
1. the string to string comparison doesn't seam to work. not a big serprise really but if I could get some advice on this as well it would be aprisiated.
2. when I tried to replace the "text/test.txt" here <temp.x = txt_load(buffer, "text/test.txt");> with filehandel wich contains that text it gives an error I figured this was becouse it was a var and not a char or string but those also seam to give me trouble since they don't alow me to do this
stringFile = "text/test.txt";
so fore every file I now have to make a hand made option. this goes well fore now since I only have 1 file but soon I do not.
also thanks fore all the help in advanced I'm really not used to asking this much help but I'm new to lite-c and have a extreamly tight deadline.