[comp.sys.atari.st] I need help!!!

vermeer@cpsc.ucalgary.ca (Willem Vermeer) (01/26/89)

I have an Atari 520ST with 1M RAM and built-in TOS. A few weeks
ago I entered the mysterious world of GEM-programming, and I tried
writing programs with dialog boxes and menubars. I use
Megamax C version 1.1
Recently, I have come across a strange error to which I can't find a
sufficient answer. I hope that the expertise available in this
news.group will help me out.

I wrote a program that first loads a .rsc-file into memory, that
contains several dialog boxes and a menubar-structure. Then the program
calls a routine multi() which controls it with a mu_mesag-call. The
program works fine although it does little more than just displaying
a dialog box upon selecting certain menu-options.

The problems started when I wanted to load a datafile into the
program. I entered a routine that uses the fileselector. This routine
works just fine. Then I wrote a routine basically like this:

1 load_file(filename)
2 char *filename;
3 {
4     FILE *whatfile,*fopen();
5     whatfile=fopen(filename,"r");
6     if (!(feof(whatfile))) fscanf(whatfile,"%d",total);
7     fclose(whatfile);
8 }

The Megamax compiler V1.1 didn't accept this and gave two errors:

               FILE *whatfile,*fopen();
"D:\PROGRAM.C", line 4: Unidentified identifier: whatfile
"D:\PROGRAM.C", line 4: Operands for * or / are not compatible.

I didn't forget to #include stdio.h or osbind.h. Also, when I wrote
a new program consisting ONLY of the above routine, the compiler
accepted it without complaining. Therefore, I suspect the reason
for the problem lies in the use of the fileselector or the .rscfile.

Does anyone have any idea if that is indeed the problem? If so/not,
what can I do about it? Surely it must be possible to write a program
with an .rscfile as well as an external datafile???

All help will be greatly appreciated. Please send me some mail;
if I get a solution, I'll post it if it's interesting enough
for other users. I'm sorry if this posting deals with some very
well-known bug or something, I'm not a very experienced GEM-user :-)

-------------------------------------------------------------------
Willem Vermeer, University of Calgary: vermeer@cpsc.UCalgary.CA
home: 1228 Varsity Estates Road Nw Calgary, AB, T3B 2W1 Canada