c ×Ö·û´®´¦Àíº¯Êý strtok Ô´Âë
/***
*strtok.c - tokenize a string with given delimiters
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* defines strtok() - breaks string into series of token
* via repeated calls.
*
*******************************************************************************/
#include
#include
#ifdef _SECURE_VERSION
#include
#else /* _SECURE_VERSION */
#include
#endif /* _SECURE_VERSION */
/***
*char *strtok(string, control) - tokenize string with delimiter in control
*
*Purpose:
* strtok considers the string to consist of a sequence of zero or more
* text tokens separated by spans of one or more control chars. the first
* call, with string specified, returns a pointer to the first char of the
* first token, and will write a null char into string immediately
* following the returned token. subsequent calls with zero for the first
* argument (string) will work thru the string until no tokens remain. the
* control string may be different from call to call. when no tokens remain
* in string a NULL pointer is returned. remember the control chars with a
* bit map, one bit per ascii char. the null char is always a control char.
*
*Entry:
* char *string - string to tokenize, or NULL to get next token
* char *control - string of characters to use as delimiters
*
*Exit:
* returns pointer to first token in string, or if string
* was NULL, to next token
* returns NULL when no more tokens remain.
*
*Uses:
*
*Exceptions:
*
*******************************************************************************/
#ifdef _SECURE_VERSION
#define _TOKEN *context
#else /* _SECURE_VERSION */
#define _TOKEN ptd->_token
#endif /* _SECURE_VERSION */
#ifdef _SECURE_VERSION
char * __cdecl strtok_s (
char * string,
const char * control,
char ** context
)
#else /* _SECURE_VERSION */
char *
Ïà¹ØÎĵµ£º
extern "C"°üº¬Ë«Öغ¬Ò壬ÆäÒ»£º±»ËüÐÞÊεÄÄ¿±êÊÇ“extern”µÄ£»Æä¶þ£º±»ËüÐÞÊεÄÄ¿±êÊÇ“C”µÄ¡£
1£©±»extern “C”ÏÞ¶¨µÄº¯Êý»ò±äÁ¿ÊÇexternÀàÐ͵ģ»
externÊÇC/C++ÓïÑÔÖбíÃ÷º¯ÊýºÍÈ«¾Ö±äÁ¿×÷Ó÷¶Î§£¨¿É¼ûÐÔ£©µÄ¹Ø¼ü×Ö£¬¸Ã¹Ø¼ü×Ö¸æËß±àÒëÆ÷£¬ÆäÉùÃ÷µÄº¯ÊýºÍ±äÁ¿¿É ......
CÏÝÚåÓÚȱÏÝÕâ±¾Ê鵽ͼÊé¹Ý½èÁ˺ܾã¬Ò»Ö±¶¼Ã»ÓÐϸϸµÄ¿´£¬ÏÖÍêÕûµÄ¿´ÁËÖ®ºó°ÑÈÏÎªÖØÒªµÄ£¬Ò»°ãÈË¿ÉÄܺöÊÓµÄÎÊÌâ¸ø×öÁ˱ʼǣ¬Ï£ÍûÓÐËù°ïÖú
2010.02.25
¶þάÊý×é:
int calendar[12][31];
int * p;
int i;
calendar[4]µÄº¬Ò壺
calendar[4]ÊÇcalendarÊý×éµÄµÚ5¸öÔªËØ£¬ÊÇcalendarÊý×éÖÐ12¸öÓÐ×Å31¸öÕûÐÍÔªËØµÄÊý×éÖ®Ò» ......
char * c = "hello"; cÊǸö·ÖÅäÔÚ¶ÑÕ»ÖеÄÒ»¸ö±äÁ¿¡£ÀïÃæ×°µÄÊÇ×Ö·û´®helloµÄÊ×µØÖ·£¬¶øhelloÊdz£Á¿Çø¡£PEÎļþÔÚ±àÒëµÄʱºò¾ÍÈ·¶¨Á˵ġ£
char []c = "hello";
"hello"ÊÇ·ÅÔÚ¶ÑÕ»Öб£´æµÄ£¬¸úÉÏÃæµÄÄǸöÀý×Ó²»Í¬£¬ÓÉÓÚhelloÊǶÑÕ»ÖеÄËùÒÔÊÇ¿ÉÒÔÐ޸ĵġ£¶ø³£Á¿ÇøÀïµÄÊDz»¿ÉÒÔÐ޸ĵġ£ÒòΪPEµÄÄÚ´æÒ³ÊôÐÔÊÇÖ»¶ÁµÄ¡£µ±È»¿ÉÒÔ ......
C°æ±¾£º
vim stash.h
#ifndef STASH_H
#define STASH_H
typedef struct STASHTag {
int size; /* Size of each space */
int quantity; /* Number of storage spaces */
int next; /* Next empty space */
/* Dynamically allocated array of bytes: */
unsigned char* ......
¡¡¡¡ÔÚÍøÂçÁ¬½ÓģʽÖÐ,³ý¶ÔµÈÍøÍâ,»¹ÓÐÁíÒ»ÖÖÐÎʽµÄÍøÂ磬¼´¿Í»§»ú/·þÎñÆ÷Íø£¬Client/Server¡£ÔÚ¿Í»§»ú/·þÎñÆ÷ÍøÂçÖУ¬·þÎñÆ÷ÊÇÍøÂçµÄºËÐÄ£¬¶ø¿Í»§»úÊÇÍøÂçµÄ»ù´¡£¬¿Í»§»úÒÀ¿¿·þÎñÆ÷»ñµÃËùÐèÒªµÄÍøÂç×ÊÔ´£¬¶ø·þÎñÆ÷Ϊ¿Í»§»úÌá¹©ÍøÂç±ØÐëµÄ×ÊÔ´¡£
¡¡¡¡ÕâÀï¿Í»§ºÍ·þÎñÆ÷¶¼ÊÇָͨÐÅÖÐËùÉæ¼°µÄÁ½¸öÓ¦Óýø³Ì£¨Èí¼þ£©¡£Ê¹ÓüÆËã» ......