Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!cwjcc!gatech!rutgers!rochester!pt.cs.cmu.edu!andrew.cmu.edu!sn0v+
From: sn0v+@andrew.cmu.edu (Shoichi Nakai)
Newsgroups: comp.sys.mac
Subject: Resource file HELP
Message-ID: 
Date: 18 Sep 88 16:57:12 GMT
Organization: Carnegie Mellon
Lines: 28

Hello,
I am a novice C programmer and am writing my first C program for the
Macintosh.  What this is going to do is to read a text from a resource
file and to display it in a window.  I got a window created successfully,
but I couldn't get a right text in a window instead I got a garbage.
Would someone help me?

I created in advance a resource file by using ResEdit and wrote a code
something like

   TEHandle teh;
   Handle   hte;
   long     len;

   teh = TENew(&dest_rect, &view_rect);

   hte = GetIndResource((ResType)"TEXT", (int)256);
   len = SizeResource(hte);
   TESetText(*hte, len, teh);

According to the debugger, after calling GetIndResource, hte still
pointed to 0x000000.  I have been struggling with this problem for a
couple of weeks but still I couldn't get out of it.
I am using LightspeedC 3.0 on Macintosh SE.
Any suggestion would be greatly appreciated.  Thank you in advance.

Shoichi Nakai
sn0v@andrew.cmu.edu