delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/12/02/01:05:37

From: "Joe Ury" <j DOT ury AT unsw DOT edu DOT au>
Newsgroups: comp.os.msdos.djgpp
Subject: parsing function not working
Date: 2 Dec 1998 05:48:07 GMT
Organization: University of New South Wales
Lines: 38
Message-ID: <01be1db7$840e4160$5640ab95@JUry.law.unsw.edu.au>
NNTP-Posting-Host: law86.law.unsw.edu.au
X-Newsreader: Microsoft Internet News 4.70.1155
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

This test (below) works OK, but when I #include the function into a larger
file I
get an "assignmet makes pointer from interger without a cast (refering to
line five of cts.inc)" msg and I am passing  type char * to it just as in
the test below.   

#include <string.h>
#include "c:\djgpp\cts.inc"
char *pc = "P005.133/C/25K";
int main()
{
float dog;
dog = CallToSort(pc);
printf("dog = %f\n",dog);
}


below is the function "cts.inc":

float CallToSort(char *buf)
{  int i = 0;
   char *tok;
   char **bp = &buf;
   double flo = 0, data[4];
       while (tok = strsep(bp, "ABCDEFGHIJKLMNOPQRSTUVWXYZ/")){
         flo = atof(tok);
         if (flo > 0){
           data[i] = flo;
           ++i;
         }
       }
  return data[0];
}

Thanks,

Joe 
j DOT ury AT unsw DOT edu DOT au

- Raw text -


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