file problem

Non-platform specific questions.

file problem

Postby DilloDude » Thu Sep 28, 2006 11:06 am

I've encountered a problem with reading from a text-file:
when I have a specific character in a text-file, sub/(substitute), the 26th character of the ascii sequence, it seems to think that the end of file has been reached. I'm reading the character with the fgetc function, and then I'm finding wether the end has been reached with feof. As far as I can figure, it's making feof return a non-zero integer afterwards. Why is this happening, is it likely to happen for other characters and how can it be avoided?
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score

Postby DilloDude » Thu Sep 28, 2006 10:20 pm

Apparently, the SUB character used to be in some cases an end of file character, so for that reason GE probably thinks it is too. So i've found a work-around to avoid using it.
However, whenever the 226 character is written in a file (using the fputc function), the next character written is the 212 character. So if I say
Code: Select all
fputc(226, file);
fputc(37, file);

it will put a 226 followed by a 212.
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score

Postby DilloDude » Fri Sep 29, 2006 12:56 am

Also, is there a way I can get a string as a paramater in a function that has more than 255 characters? I've tried a few ways, but they don't seem to work.
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score

Postby makslane » Fri Sep 29, 2006 10:03 pm

The strings created in the Variables panel have a max lenght of 255.
If you need more, declare your variable in the Global Code editor:

Code: Select all
char mystring[1024];
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby DilloDude » Tue Oct 03, 2006 2:38 am

I think the problem I have is with actor texts. The actor text can display texts with more than 255 characters (if you use strcpy or text input), but the actual text variable is only 255 characters. If you are just using strcpy or something, it's alright, because you can use the source rather than the text, but if you are using text input, there isn't really much you can do.
Is there any way I might be able to do a work-around?
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score

Postby makslane » Wed Oct 04, 2006 5:42 pm

I can't think in a solution now
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest