delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1996/12/08/01:36:19

From: sac24983 AT saclink DOT csus DOT edu ("Horia F. Pop")
Subject: C++ problem
8 Dec 1996 01:36:19 -0800 :
Sender: daemon AT cygnus DOT com
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <32AA13EA.190C.cygnus.gnu-win32@saclink.csus.edu>
Reply-To: sac24983 AT saclink DOT csus DOT edu
Mime-Version: 1.0
X-Mailer: Mozilla 3.01 (Win95; I)
Original-To: gnu-win32 AT cygnus DOT com
Original-Sender: owner-gnu-win32 AT cygnus DOT com

Dear sirs,

I just installed B17. I have a problem with one of the string handling
functions. Please see the source:

-------------------
#include <string.h>
#include <stdio.h>

main()
{
  char *x, *y;
  x = strtok("123 456 789 abc", " ");
  y = strtok(x, " ");

  printf("%s %s\n", x, y);
}
-------------------

and the compilation output:

-------------------
t.cc: In function `int main()':
t.cc:7: warning: implicit declaration of function `int strtok(...)'
t.cc:7: warning: assignment to `char *' from `int' lacks a cast
t.cc:8: warning: assignment to `char *' from `int' lacks a cast
-------------------

Even if the function strtok is in the file string.h, the conditionals
inside the header seem to comment the declaration of the function. What
do I have to do? The executable produces a runtime error.

Thank you for your help.

Yours, Horia Pop
-
For help on using this list, send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


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