Re: GenText-Porblem

GWRepNate@aol.com
Fri, 24 Jan 1997 13:29:38 -0500 (EST)

In a message dated 97-01-24 08:13:23 EST, pilz@cs.tu-berlin.de (Joerg
Polzfusz) writes:
> Hello!
> Can anybody tell me, why "ReadText" fails after working perfectly with the
> first 20 or 30 characters?
> -Nope, I'm not using more than 32k characters!
> -Nope, the gpk-file contains normal characters (in the segment I'm
reading).
> -Nope, the routine fails in different places in different gpk-files, but
> after
> the same character in the same file on two different PCs running
Geos2x-NC
> or NewDeal Office 2.5.
> -Nope, I'll have to do it this way, because I only know where the text
will
> start in the file and that it'll end somewhere with a 0x00-byte.
> -Swat doesn't give me any useful clues: "invalid handle" or "invalid
code".
>
> Confused
> Joerg
>
> ==========================CODE===========================
>
> @object GenTextClass Ausgabe = {
> GI_attrs= @default | GA_READ_ONLY;
> GTXI_text = "This is only a BETA-version!";
> GTXI_attrs = @default | GTA_INIT_SCROLLING;
> GTXI_stateFlags = @default | GTSF_INDETERMINATE;
> HINT_TEXT_CURSOR_AT_END;
> HINT_TEXT_WHITE_WASH_COLOR;
> ATTR_GEN_TEXT_DO_NOT_INTERACT_WITH_SEARCH_CONTROL;
> ATTR_GEN_TEXT_DOES_NOT_ACCEPT_INK;
> ATTR_GEN_TEXT_DEFAULT_CHAR_ATTR =
> ((VTDS_10 << VTDCA_SIZE_OFFSET) | VTDF_BERKELEY);
> /* This sets the default character attributes record (of type
> * VisTextDefaultCharAttr) to use Berkeley font in
> * point size 10. */
> };
>
> void ReadText(FileHandle gpk, dword tBeg)
> { char x=1; /* init to !=0 due to the while-loop */
>
> FilePos(gpk, tBeg, FILE_POS_START);
> while (x!=0) {
> FileRead(gpk,&x,1,FALSE);
> if ((x) && (x!=0x0A)) @call Ausgabe::MSG_VIS_TEXT_APPEND_PTR(&x,1);
> }
> @call Ausgabe::MSG_VIS_TEXT_APPEND_PTR("\r\0",0); /*add a new line*/
> }

I don't see anything wrong with this code. I'm not sure that it will help,
but could you post screen dump of the Swat screen after the crash? And
include a backtrace ("bt") in that dump. That will help put the crash in
context.

Nathan