www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/14/16:30:26

From: "DeHackEd" <Not DOT given AT out>
References: <35841B3F DOT 8B7646B AT netrover DOT com>
Subject: Re: [Allegro] Datafile problem
Date: Sun, 14 Jun 1998 16:18:07 -0400
Lines: 64
Message-ID: <uypxwG9l9GA.220@upnetnews05>
Newsgroups: comp.os.msdos.djgpp
NNTP-Posting-Host: d16-bn46-blvl-pda.attcanada.net [142.194.137.208]
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Ok, let's take a look at this...


Nicolas Blais wrote in message <35841B3F DOT 8B7646B AT netrover DOT com>...
>When I load a datafile within my program, it goes fine, but when I try
>to access data out of it, it gives me Warning : Ansi C++ forbids
>implicit conversion from 'Void *' in argument passing.  This warning
>appears on every line I try to access some BMP or a midi file in the
>example below.  I checked my header file created with grabber and it's
>fine, so where is the problem below?
>


This is explained in the allegro.txt file. C will accept it, but C++ is a little
more warry of converting pointers of different types. If you say something like
MIDI * = void *, it will be a little upset. Cast.

MIDI * = (MIDI*)void*;

This is annoying, but necessary. You may be able to specify commands to make it
ignore this... I'm not sure

>DATAFILE *datafile;
> strcpy(buf, argv[0]);
> strcpy(get_filename(buf), "qfpc.dat");

You got this from the Allegro demo didn't you... :)
This is only useful if you KNOW the datafile is with the EXE.

> datafile = load_datafile(buf);
> if (!datafile)
>    {
>    allegro_exit();
>    printf("Error loading qfpc.dat!\n\n");
>    return 1;
>    }
>the_music = load_midi(datafile[Main].dat);    // Error here.
>play_midi(the_music, TRUE);


Wrong. This only works if the entry is of type DATA.

Replace those lines with the one:

play_midi(datafile[Main].dat, TRUE);

The entry is in a specific format, and is not the same as a disk midi (and you
have a char* pointer to insert, not a datafile pointer). fopen will puke on it
and load_midi will simply abort.

>
>/* BLA BLA BLA*/
>
>Thanks, Nicolas Blais
>

--
"DeHackEd"

My Email address in the header is fake (spammers). Assemble this to get it:
(myname) 72 (at) hotmail.com



- Raw text -


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