delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/01/12/21:04:33

Xref: news-dnh.mv.net comp.os.msdos.djgpp:4281
Path: news-dnh.mv.net!mv!news.sprintlink.net!kern.com!winternet.com!news.interlog.com!news.dra.com!news.mid.net!news.flinthills.com!mccall.com!news.ksu.ksu.edu!news.physics.uiowa.edu!math.ohio-state.edu!uwm.edu!vixen.cso.uiuc.edu!howland.reston.ans.net!blackbush.xlink.net!news.dfn.de!news.ruhr-uni-bochum.de!usenet
Newsgroups: comp.os.msdos.djgpp
Subject: cbgrx problem
Message-ID: <30F4EF88.2781@LSTM.Ruhr-UNI-Bochum.De>
From: Thomas Demmer <demmer AT LSTM DOT Ruhr-UNI-Bochum DOT De>
Date: Thu, 11 Jan 1996 12:07:52 +0100
Organization: Lehrstuhl fuer Stroemungsmechanik
NNTP-Posting-Host: bvb.lstm.ruhr-uni-bochum.de
Lines: 49
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Can someone explain to me what's wrong with the following code:

#include <stdio.h>
#include <stdlib.h>
#include <gppconio.h>
#include <grx/grx.h>
#include <string.h>

GrFont *fnt;
GrTextRegion txt1;
char *tx1;


int main(int argc, char **argv){
    GrSetMode(GR_width_height_color_graphics,800,600,32768);
    if(! (fnt=GrLoadFont("@:pc8x14.fnt"))){
        GrSetMode(GR_default_text);
        fprintf(stderr,"Cannot load font\n");
        exit(3);
    }
    tx1  = malloc(4096);
    memset(tx1, 65,4096);

    txt1.txr_font = fnt;
    txt1.txr_buffer= tx1;
    txt1.txr_backup= NULL;
    txt1.txr_xpos= 5;
    txt1.txr_ypos= 5;
    txt1.txr_width =  20;
    txt1.txr_height = 1;
    txt1.txr_lineoffset = 1;
    txt1.txr_fgcolor.v = GrWhite();
    txt1.txr_bgcolor.v = 0;
    txt1.txr_chrtype = GR_BYTE_TEXT;
    GrDumpText(1,1,1,1,&txt1);
    getch();
    GrSetMode(GR_default_text);
    return 0;
}

It crashes when reaching GrDumpText() with an segment violation.

I use gcc2.6.3, go32 1.12 maint3 and the libgrx.a by Csaba Biegl from
cbgrx103.zip.
GrDrawString() and alikes which use GrTextOption work without problems.

Thanks

Ciao

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019