J
Joe Cipale
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 #
#----------------------------------------------------------#
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 #
#----------------------------------------------------------#