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 *
相关文档:
C陷阱于缺陷这本书到图书馆借了很久,一直都没有细细的看,现完整的看了之后把认为重要的,一般人可能忽视的问题给做了笔记,希望有所帮助
2010.02.25
二维数组:
int calendar[12][31];
int * p;
int i;
calendar[4]的含义:
calendar[4]是calendar数组的第5个元素,是calendar数组中12个有着31个整型元素的数组之一 ......
#include <stdio.h>
#define SIZE 50
int main()
{
FILE *fps=NULL;
fps=fopen("tests.txt","r");
FILE *fpd=NULL;
fpd=fopen("testd.txt","wt+");
fseek(fpd,0,SEEK_END);
char buffer[SIZE];
while (fps || fpd)
{
int t=fread(buffer,sizeof(char),SIZE,fps);
if (t==0)
{
bre ......
char * c = "hello"; c是个分配在堆栈中的一个变量。里面装的是字符串hello的首地址,而hello是常量区。PE文件在编译的时候就确定了的。
char []c = "hello";
"hello"是放在堆栈中保存的,跟上面的那个例子不同,由于hello是堆栈中的所以是可以修改的。而常量区里的是不可以修改的。因为PE的内存页属性是只读的。当然可以 ......
W3C标准的HTML标签
按功能类别排列
DTD:指示在哪种 XHTML 1.0 DTD 中允许该标签。
S=Strict,严格类型, T=Transitional,过渡类型【最普遍】, F=Frameset,框架类型.
标签成对,xhtml是比html更严格,类似XML格式
标签描述DTD
<!DOCTYPE>
定义文档类型。
STF
<html>
定义 HTML 文档。
STF
< ......