View Single Post
  #1 (permalink)  
Old 04-03-2008, 03:28 PM
hybridalter hybridalter is offline
Newbie
 
Join Date: Apr 2008
Posts: 7
Rep Power: 0
hybridalter is on a distinguished road
Red face Help! Problem with string manipulation and using tokens??

hi all, im doing this problem with string manipulation (C programming on MS Visual Studio 2005 Pro Ed.) and im crapping out on calling this function that i have under routines.cpp when trying to call it from main.cpp

the function prototype (which i have under routines.h) is:
int tokenize(char *token[ ], int max_tokens, char *str);

and i have the actual function in routines.cpp as this:
Code:
#include "routines.h"
#include <stdio.h>
#include <string.h>

int tokenize(char token[ ], int max_tokens, char *str)
{	
	printf("%s\n%s\n\n%s\n",
		"The string to be tokenized is:", token,
		"The tokens are:" );

	str = strtok (token, " ");

	while (str != NULL) {
		printf("%s\n", str);
		str = strtok(NULL, " ");
	}
	return 0;
}
------------------------------------------------------------

and so, if i wanted to call this function from main.cpp how would i do that?

i have: tokenize(*token, max_tokens, *str);

but i know its wrong because it wont compile. Please help on how to call this function from main.cpp, i have horrible skills with calling functions. THANK YOU IN ADVANCE

Last edited by WingedPanther; 04-03-2008 at 04:42 PM. Reason: Add code tags
Reply With Quote

Sponsored Links