stringopt.cpp

来自「MPICH是MPI的重要研究,提供了一系列的接口函数,为并行计算的实现提供了编程」· C++ 代码 · 共 49 行

CPP
49
字号
#include "StringOpt.h"#include <ctype.h>// Function name	: GetStringOpt// Description	    : // Return type		: int // Argument         : char *pszString// Argument         : char cOpt// Argument         : char *pOutStringint GetStringOpt(char *pszString, char cOpt, char *pOutString){	bool bFound = false;	char *token;	*pOutString = '\0';	token = pszString;	while (isspace(*token))		token++;	while (*token != '\0')	{		if (*token == cOpt)			bFound = true;		token++;		if (*token == '\'')			token++;		while (*token != '\'' && *token != '\0')		{			if (bFound)			{				if ((*token == '\\') && (*(token+1) == '\''))					token++;				*pOutString = *token;				pOutString++;			}			token++;		}		if (bFound)		{			*pOutString = '\0';			return 0;		}		if (*token != '\0')			token++;	}	return 1;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?