[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

warnings, HJÆÆÆÆLP!!!!



Hejsa

 Jeg er ved at få grå hår, over nogle warnings i et lille program jeg er
ved at strikke sammen. Og det syntes jeg er lidt for tidligt (er kun 25
år).

 Nå, men til sagen, jeg har følgende rutine i mit program, som returnerer
længden (i sekunder) af en mp3 sang, som er gemt i en mysql database. :

int song_length(int songid)
{

MYSQL_RES *res;
MYSQL_ROW *row;
char query[50];
int length;
        sprintf(query,"select length from songs where id=%u",songid);

        mysql_query(&mysql,query);
        res = mysql_use_result(&mysql);
        row = mysql_fetch_row(res);
        length = atoi(row[0]);
        mysql_free_result(res);
        return length;
}

 Det skulle nogenlunde være lige efter bogen, kunne måske være lavet lidt
smartere, men det er mit første 'rigtige' c program... Det resulterer i
følgende warnings, som jeg ikke helt kan greje (det er jo ifølge bogen, og
skulle vel ikke være forkert?)

mp3play.c: In function `song_length':
mp3play.c:84: warning: assignment from incompatible pointer type
mp3play.c:85: warning: passing arg 1 of `atoi' from incompatible pointer
type


Næste eksempel er (fra samme program) følgende, hvor jeg bruger ioperm
til at opnå adgang til 2 porte, nemlig printerportens data og control
porte. Jeg ved godt at det er dirty, men det er umiddelbart det nemmeste
(og hurtigste).

        if (ioperm(pdata,1,1)||ioperm(control,1,1)) {
                printf("Sorry, you were not able to gain access to the
ports\n"
                printf("You must be root to run this program\n");
                exit(1);
        }

Den returnerer så med følgende fejl:

mp3play.c: In function `main':
mp3play.c:301: warning: implicit declaration of function `ioperm'

 Igen, det er lavet efter bogen, så hvorfor hulen laver den en warning???
Er der noget jeg har misforstået et eller andet sted??


Thomas Mørch

Ps. den fulde source kode kan findes på www.image.dk/~spaceguy/mp3 under
download. og ja, jeg ved godt det ikke er en pæn homepage...




 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:07 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *