Q/Confused

From: Joe Cipale (joec_at_aracnet.com)
Date: 04/30/04


Date: Fri, 30 Apr 2004 10:14:56 -0700

I am trying to parse a data entry in a procedure. The procedure will
parse a data string on either a '/' or a ':'. My proceudre is delcared
as follows:
void chr_pad(char dte_str[16], char chr_tok)

The usage is:
chr_pad(dte_str, '/');

Within the code, I take advantage of the var 'chr_tok' in this manner:
   strcpy(f1, strtok(dte_str, chr_tok));
   strcpy(f2, strtok(NULL, chr_tok));
   strcpy(f3, strtok(NULL, chr_tok));

When I attempt to compile the code, I get the following errors:
misc.cpp: In function `void chr_pad(char *, char)':
misc.cpp:360: passing `char' to argument 2 of `strtok(char *, const char
*)' lacks a cast
misc.cpp:361: passing `char' to argument 2 of `strtok(char *, const char
*)' lacks a cast
misc.cpp:362: passing `char' to argument 2 of `strtok(char *, const char
*)' lacks a cast

I am not seeing (blatantly) where the problem lies. Can one of you offer
a tip here?

TIA,

Joe Cipale

-- 
#----------------------------------------------------------#
#                "Don't fear the penguin!"                 #
#----------------------------------------------------------#
# Registered Linux user: #309247     http://counter.li.org #
#----------------------------------------------------------#


Relevant Pages

  • Re: Q/Confused
    ... > I am trying to parse a data entry in a procedure. ... > The usage is: ... > *)' lacks a cast ... parameter has type 'const char *', ...
    (comp.lang.cpp)
  • RE: Parsing a Text String into 4 Different Fields
    ... you might use the Split command to split the data up in the data entry ... I guess you could first check to see if there is a comma. ... transferred from the originating form via openargs. ... Can anyone please share with me on how to parse this field? ...
    (microsoft.public.access.modulesdaovba)
  • Reading in text and casting it
    ... parse into individual numbers and then cast the ... floats into binary, before writing all the binary numbers to another ... break up the text, but when i try and cast it, i get an error saying ...
    (comp.lang.java.programmer)