当前位置: 首页>>代码示例>>C++>>正文


C++ FormatStr函数代码示例

本文整理汇总了C++中FormatStr函数的典型用法代码示例。如果您正苦于以下问题:C++ FormatStr函数的具体用法?C++ FormatStr怎么用?C++ FormatStr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了FormatStr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ASSERT

void CStoreGroupData::operator () (SGroupData* pGroupData)
{
	ASSERT(pGroupData);
	ASSERT(pGroupData->data_vect);

	++ m_nProgressCurrent;

	m_file.WriteString("**********\n");
	m_file.WriteString(FormatStr("%d\n", m_nProgressCurrent));
	m_file.WriteString(pGroupData->time + "\n");
	m_file.WriteString(pGroupData->user + "\n");

	for (SDataVect::iterator it = pGroupData->data_vect->begin(); pGroupData->data_vect->end() != it; ++ it)
	{
		SData *&data = (*it);
		m_file.WriteString(FormatStr("%s\n%d\n", data->file, data->version));
	}

	m_file.WriteString("\n");

	if (0 == m_nProgressCurrent % 1000)
	{
		printf("\r>> %d%%", 100 * m_nProgressCurrent / m_nProgressSize);
	}
}
开发者ID:Gediminas,项目名称:vss2git,代码行数:25,代码来源:Data.cpp

示例2: FormatStr

void			TMDIChild::SetSelectDetail()
{
    //详细信息显示在右边
    memWatch->Lines->Clear();

    tagSelRect	selRect;
    if(GetTreeSelRect(selRect) == false)
        return;

    String info = FormatStr("偏移 : %d", selRect.SelStart);
    memWatch->Lines->Add(info);

    info = FormatStr("长度 : %d", selRect.SelLength);
    memWatch->Lines->Add(info);

    info = "";

    ParseTreeNode * curNode = (ParseTreeNode * )tvParseTree->Selected->Data;
    if(curNode)
    {
        if(curNode->GetClassMember()->GetType() == "char" && curNode->GetClassMember()->GetArrayVar() != "")
        {
            info = curNode->GetParseResult();
        }
    }

    info = FormatStr("信息 : %s", info);
    memWatch->Lines->Add(info);
}
开发者ID:eggxp,项目名称:SuperParse,代码行数:29,代码来源:CHILDWIN.cpp

示例3: DoHTTPProxyTunnel

int DoHTTPProxyTunnel(STREAM *S, char *Host, int Port, int Flags)
{
char *Tempstr=NULL, *Token=NULL, *ptr=NULL;
int result=FALSE;

	if (Flags & CONNECT_SSL) Tempstr=FormatStr(Tempstr,"CONNECT https://%s:%d HTTP/1.1\r\n\r\n",Host,Port);
	else Tempstr=FormatStr(Tempstr,"CONNECT http://%s:%d HTTP/1.1\r\n\r\n",Host,Port);
	STREAMWriteLine(Tempstr,S);
	STREAMFlush(S);
	
	Tempstr=STREAMReadLine(Tempstr,S);
	StripTrailingWhitespace(Tempstr);

	ptr=GetToken(Tempstr," ",&Token,0);
	ptr=GetToken(ptr," ",&Token,0);

	if (*Token==2) result=TRUE;
	while (StrLen(Tempstr))
	{
		Tempstr=STREAMReadLine(Tempstr,S);
		StripTrailingWhitespace(Tempstr);
	}

DestroyString(Tempstr);
DestroyString(Token);

return(result);
}
开发者ID:ColumPaget,项目名称:FileFerry,代码行数:28,代码来源:ConnectionChain.c

示例4: FormatStr

bool			AuthClientUser::SendLogMessage(AnsiString msg)
{
	String warnMsg = FormatStr("%s(%s) : %s", m_UserName, m_ClientIP, String(msg));
	GetLog()->Warn(warnMsg);
	GetThreadManager()->AddGUIMessage(warnMsg);

	AnsiString sendMsg = msg;
	sendMsg.Unique();
	if(!this->SocketSendBYTE(PT_MSG))
		return false;

	if(!this->SocketSendWORD(sendMsg.Length()))
		return false;

	if(!this->SocketSendBuff(sendMsg.c_str(), sendMsg.Length()))
		return false;

	if(m_ADOQuery)
	{
		m_ADOQuery->SQL->Text = FormatStr("INSERT user_error_msg (accid, cur_time, build, ip, msg) VALUES ('%s', '%s', %d, '%s', '%s')",
										m_UserName, DateTimeToStr(Now()), m_Build, m_ClientIP, String(msg));
		ExecSQL(m_ADOQuery);
	}
//	Sleep(1000);
	return true;
}
开发者ID:KerwinMa,项目名称:eggxp_view,代码行数:26,代码来源:AuthServerListener.cpp

示例5: IntToStr

//---------------------------------------------------------------------
void			TMDIChild::SetFileDescribe(FileStruct * curFile)
{
    memInfo->Lines->Clear();
    memInfo->Lines->Add(FormatStr("描述 : %s", curFile->GetDescribe()));
    String key_str = IntToStr(int(curFile->GetKey()));
    memInfo->Lines->Add(FormatStr("Key : %s", key_str));
    memInfo->Lines->Add(FormatStr("时间 : %s", curFile->GetDateTime()));
    memInfo->Lines->Add(FormatStr("详情 : %s", curFile->GetRemark()));
}
开发者ID:eggxp,项目名称:SuperParse,代码行数:10,代码来源:CHILDWIN.cpp

示例6: STREAMWriteLine

STREAM *IDriveOpenFile(TFileStore *FS, TFileInfo *FI, int Flags)
{
char *URL=NULL, *Tempstr=NULL, *Boundary=NULL, *FullPath=NULL, *ptr;
HTTPInfoStruct *Info;
TFileInfo *tmpFI;

  if (Flags & OPEN_WRITE)
	{
  URL=MCopyStr(URL,"https://",FS->Host,"/evs/uploadFile",NULL);
	Info=HTTPInfoFromURL("POST",URL);
	
	Boundary=FormatStr(Boundary,"%x-%x-%x",getpid(),time(NULL),rand());
	Info->PostContentType=MCopyStr(Info->ContentType,"multipart/form-data; boundary=",Boundary,NULL);

	Tempstr=MCopyStr(Tempstr,"--",Boundary,"\r\n","Content-disposition: form-data; name=uid\r\n\r\n",FS->Logon,"\r\n",NULL);
	Tempstr=MCatStr(Tempstr,"--",Boundary,"\r\n","Content-disposition: form-data; name=pwd\r\n\r\n",FS->Passwd,"\r\n",NULL);
	Tempstr=MCatStr(Tempstr,"--",Boundary,"\r\n","Content-disposition: form-data; name=p\r\n\r\n",FS->CurrDir,"\r\n",NULL);
	//Tempstr=MCatStr(Tempstr,"--",Boundary,"\r\n","Content-disposition: form-data; name=myfiles\r\n\r\n",Path,"\r\n",NULL);
	Tempstr=MCatStr(Tempstr,"--",Boundary,"\r\n","Content-disposition: form-data; charset=UTF-8; name=definition; filename=",FI->Path,"\r\nContent-type: image/jpeg\r\n\r\n",NULL);

	Info->PostContentLength=FI->Size+StrLen(Tempstr)+StrLen(Boundary)+8;
	FS->S=HTTPTransact(Info);
	FS->Extra=Info;

	STREAMWriteLine(Tempstr,FS->S);
	STREAMSetValue(FS->S,"Boundary",Boundary);
	Tempstr=FormatStr(Tempstr,"%d",FI->Size);
	STREAMSetValue(FS->S,"Transfer-Size",Tempstr);
	}
	else
	{
			if (*FI->Path=='/') FullPath=CopyStr(FullPath,FI->Path);
			else FullPath=MCopyStr(FullPath,FS->CurrDir,FI->Path,NULL);

			Tempstr=HTTPQuote(Tempstr,FullPath);

//		if (OpenFI->Version) FI=OpenFI;
//		else FI=FileStoreGetFileInfo(FS, FI->Path);

		  URL=FormatStr(URL,"https://%s/evs/downloadFile?uid=%s&pwd=%s&p=%s&version=%d",FS->Host,FS->Logon,FS->Passwd,Tempstr,FI->Version);
			FS->S=HTTPMethod("POST",URL,"","","","",0);
			FS->Extra=NULL;
//		if (FI != OpenFI) FileInfoDestroy(FI);
	}

	DestroyString(URL);
	DestroyString(FullPath);
	DestroyString(Tempstr);
	DestroyString(Boundary);

   return(FS->S);
}
开发者ID:ColumPaget,项目名称:FileFerry,代码行数:52,代码来源:idrive.c

示例7: FormatStr

	pplx::task<http::http_response> RealSteamDataConnection::GetMessages(int baseMessage, const wchar_t * pwzSteamID, bool fSecure)
	{
		std::string strPostData;

		if (fSecure)
			strPostData = FormatStr(STEAM_CHAT_POLL_POST_DATA_FMT_SZ, GetAccessToken(), pwzSteamID, GetUMQID(), baseMessage);
		else
			strPostData = FormatStr(STEAM_CHAT_POLLSTATUS_POST_DATA_FMT_SZ, pwzSteamID, GetUMQID(), baseMessage);

		http::client::http_client  client(fSecure ? STEAM_POST_OAUTH_POLL_URI : STEAM_POST_OAUTH_POLLSTATUS_URI);
		http::http_request         request = CreateHttpPostRequest(strPostData);

		return client.request(request);
	}
开发者ID:galenelias,项目名称:VapoRT,代码行数:14,代码来源:SteamDataConnection.cpp

示例8: DisplayTransferStatus

void DisplayTransferStatus(char *Line, unsigned int transferred, unsigned int total, unsigned int *percent, unsigned int secs,int CmdFlags, int Throttle)
{
int result=0, cols=80, bps=0;
char *Tempstr=NULL, *TimeStr=NULL, *ptr=NULL;
static int ThrotCount=0;
struct winsize w;


	if (Settings.Flags & FLAG_QUIET) return;
	if (CmdFlags & FLAG_QUIET) return;
	if (! isatty(1)) return;

	ptr=getenv("COLUMNS");
	if (ptr) cols=atoi(ptr);
	printf("\r");
	if (total==0) Tempstr=FormatStr(Tempstr,"%s bytes sent ",GetHumanReadableDataQty(transferred,0));
	else
	{
	result=(transferred * 100) / total;
//	if (result != *percent)
	{
		Tempstr=FormatStr(Tempstr,"%d%% %s of ",result,GetHumanReadableDataQty(transferred,0));
		Tempstr=CatStr(Tempstr,GetHumanReadableDataQty(total,0));
	}
	*percent=result;
	}

bps=transferred / secs;
TimeStr=FormatStr(TimeStr," in %d secs %s Bps ",secs,GetHumanReadableDataQty(bps,0) );

if ((Throttle > 0) && (bps > Throttle)) 
{
	ThrotCount++;
	usleep(ThrotCount * 250000);
}
else if (ThrotCount > 0) ThrotCount--;

if (ThrotCount > 0) Tempstr=MCatStr(Tempstr,TimeStr, Line, " (throttling)      ",NULL);
else Tempstr=MCatStr(Tempstr,TimeStr, Line, "           ",NULL);


ioctl(0, TIOCGWINSZ, &w);
if (StrLen(Tempstr) > w.ws_col) Tempstr[w.ws_col]='\0';

printf("%s",Tempstr);
fflush(NULL);

DestroyString(TimeStr);
DestroyString(Tempstr);
}
开发者ID:zhangjinde,项目名称:FileFerry,代码行数:50,代码来源:commands-file-transfer.c

示例9: main

main()
{
char *Tempstr=NULL;
ListNode *Vars, *Streams;
STREAM *S;
int i;
char *IP[]={"217.33.140.70","8.8.8.8","4.2.2.1","88.198.48.36",NULL};

Vars=ListCreate();
Streams=ListCreate();
MessageBusRegister("proc:tester.test.func", 4, 10, Tester);
MessageBusRegister("http://freegeoip.net/xml/", 4, 10, NULL);

printf("PARENT: %d\n",getpid());
for (i=0; i < 4; i++)
{
Tempstr=FormatStr(Tempstr,"string=hello&integer=%d",i);
MessageBusWrite("proc:tester.test.func", Tempstr);
MessageBusWrite("http://freegeoip.net/xml/", IP[i]);

MessageQueueAddToSelect(Streams);
S=STREAMSelect(Streams, NULL);
if (S) 
{
	MessageBusRecv(S, &Tempstr, Vars);
	DumpVars(Vars);
}
else printf("NO ACTIVITY!\n");
sleep(1);
}


}
开发者ID:ColumPaget,项目名称:daytime,代码行数:33,代码来源:test.c

示例10: SSL_CIPHER_get_name

const char *OpenSSLQueryCipher(STREAM *S)
{
void *ptr;

if (! S) return(NULL);
ptr=STREAMGetItem(S,"LIBUSEFUL-SSL-CTX");
if (! ptr) return(NULL);

#ifdef HAVE_LIBSSL
const SSL_CIPHER *Cipher;
char *Tempstr=NULL;

Cipher=SSL_get_current_cipher((const SSL *) ptr);

if (Cipher)
{
Tempstr=FormatStr(Tempstr,"%d bit %s",SSL_CIPHER_get_bits(Cipher,NULL), SSL_CIPHER_get_name(Cipher));
STREAMSetValue(S,"SSL-Cipher",Tempstr);

Tempstr=SetStrLen(Tempstr,1024);
Tempstr=SSL_CIPHER_description(Cipher, Tempstr, 1024);


STREAMSetValue(S,"SSL-Cipher-Details",Tempstr);
}

DestroyString(Tempstr);
return(STREAMGetValue(S,"SSL-Cipher"));

#else
return(NULL);
#endif
}
开发者ID:ColumPaget,项目名称:MetaFTPD,代码行数:33,代码来源:openssl.c

示例11: DoHTTPProxyTunnel

int DoHTTPProxyTunnel(STREAM *S, const char *Host, int Port, const char *Destination, int Flags)
{
char *Tempstr=NULL, *Token=NULL;
const char *ptr=NULL;
int result=FALSE;

	S->in_fd=ConnectToHost(Host,Port,0); 
	S->out_fd=S->in_fd;
	if (S->in_fd == -1) return(FALSE);

	ptr=Destination;
	if (strncmp(ptr,"tcp:",4)==0) ptr+=4;
	Tempstr=FormatStr(Tempstr,"CONNECT %s HTTP/1.1\r\n\r\n",ptr);

	STREAMWriteLine(Tempstr,S);
	STREAMFlush(S);
	
	Tempstr=STREAMReadLine(Tempstr,S);
	StripTrailingWhitespace(Tempstr);

	ptr=GetToken(Tempstr," ",&Token,0);
	ptr=GetToken(ptr," ",&Token,0);

	if (*Token=='2') result=TRUE;
	while (StrLen(Tempstr))
	{
		Tempstr=STREAMReadLine(Tempstr,S);
		StripTrailingWhitespace(Tempstr);
	}

DestroyString(Tempstr);
DestroyString(Token);

return(result);
}
开发者ID:ColumPaget,项目名称:Alaya,代码行数:35,代码来源:ConnectionChain.c

示例12: STREAMSetFlushType

STREAM *STREAMSpawnFunction(BASIC_FUNC Func, void *Data, const char *Config)
{
    int to_fd, from_fd, *iptr;
    pid_t pid=0;
    STREAM *S=NULL;
    char *Tempstr=NULL;
    int Flags=0;

    Flags=TTYParseConfig(Config, NULL);
    if (Flags & TTYFLAG_PTY)
    {
        pid=PseudoTTYSpawnFunction(&to_fd, Func, Data, Flags, Config);
        from_fd=to_fd;
    }
    else
    {
        iptr=NULL;
        //if (Flags & COMMS_COMBINE_STDERR) iptr=(int *) COMMS_COMBINE_STDERR;
        pid=PipeSpawnFunction(&to_fd, &from_fd, iptr, Func, Data, Config);
    }

    if (pid > 0) S=STREAMFromDualFD(from_fd, to_fd);
    if (S)
    {
        STREAMSetFlushType(S,FLUSH_LINE,0,0);
        Tempstr=FormatStr(Tempstr,"%d",pid);
        STREAMSetValue(S,"PeerPID",Tempstr);
        S->Type=STREAM_TYPE_PIPE;
    }

    DestroyString(Tempstr);
    return(S);
}
开发者ID:ColumPaget,项目名称:Hashrat,代码行数:33,代码来源:SpawnPrograms.c

示例13: IntToHex

void __fastcall TDesignFrm::btStartNewClick(TObject *Sender)
{
    if(SourceGenDesignFrm->StartDesign() == false)
        return;

    String  fileName, head, subHead;
    m_WorkSpaceManager->BeginUpdate();
    for(int i=0; i<SourceGenDesignFrm->GetHeadCount(); i++)
    {
        for(int j=0; j<SourceGenDesignFrm->GetSubHeadCount(); j++)
        {
            head = IntToHex(i+1, 2);
            subHead = IntToHex(j+1, 2);
            fileName = FormatStr("Pack_%s_%s.eggxp", head, subHead);
            WorkSpace	*  selWorkSpace = m_WorkSpaceManager->CreateNewWorkSpace();
            selWorkSpace->InitWorkSpace(m_WorkSpaceManager->GetFilePath(),
						fileName, head + " " + subHead);

			selWorkSpace->GetFileManager()->CreateNew();
            selWorkSpace->SaveToFile();            
        }
    }

    m_WorkSpaceManager->ReloadWorkSpacePack();
    WorkspaceToGUI();
    m_WorkSpaceManager->EndUpdate();
}
开发者ID:eggxp,项目名称:SuperParse,代码行数:27,代码来源:FrmDesign.cpp

示例14:

char *FinalizeDirListHTML(char *Buffer, HTTPSession *Session, const char *Path, const char *DirItemsHtml, const char *MimeIconsURL, int Flags)
{
char *HTML=NULL;

	HTML=FormatStr(Buffer,"<html>\r\n<head><title>/%s%s</title></head>\r\n<body>\r\n",Session->Host, Session->URL);

	if ((Flags & DIR_FANCY))
	{
		if (Flags & DIR_INTERACTIVE) HTML=CatStr(HTML,"<form>\r\n");

		HTML=CatStr(HTML,"<table align=center border=0><tr>\n");
		if (Settings.Flags & FLAG_SSL) HTML=MCatStr(HTML,"<td><font color=green size=-1>SECURE<br/>",Session->Cipher,"</font></td>\n",NULL);
		else HTML=MCatStr(HTML,"<td><font color=red size=-1>Unencrypted<br/>Connection</font></td>\n",NULL);

		HTML=MCatStr(HTML,"<td><b>",Session->URL,"</b> at ",Session->Host, " <i>",GetDateStrFromSecs("%Y/%m/%d %H:%M:%S",Now,NULL),"</i><br/>",NULL);

		HTML=DisplayDirActions(HTML,Session,Flags);
		HTML=CatStr(HTML,"</td>\n");


		HTML=MCatStr(HTML,"<td>User: ",Session->UserName,"<br/>",NULL);
		if (Settings.Flags & FLAG_LOGOUT_AVAILABLE) HTML=MCatStr(HTML,"<a href=\"",GetLogoutPath(),"\">( Logout )</a>",NULL);
		HTML=CatStr(HTML,"</td></tr></table>\n");
	}
	HTML=MCatStr(HTML,DirItemsHtml,"<br />&nbsp;<br />",NULL);
	if (Flags & DIR_INTERACTIVE) HTML=CatStr(HTML,"</form>\r\n");
	HTML=CatStr(HTML,"</body></html>\r\n");

return(HTML);
}
开发者ID:ColumPaget,项目名称:Alaya,代码行数:30,代码来源:directory_listing.c

示例15: btDeleteSubHeadClick

void __fastcall TDesignFrm::btDeleteSubHeadClick(TObject *Sender)
{
    String fileName = vleSubHeadDef->Keys[vleSubHeadDef->Row];

    int result = Application->MessageBox(FormatStr(L"当真要删除文件 : %s(此操作不可恢复)", fileName).c_str(),L"删除询问",MB_OKCANCEL);
    if(result == IDCANCEL)
    {
        return;
    }

    WorkPackHead * curWorkPackHead = m_WorkSpaceManager->GetWorkSpacePacks()->FindWorkPack(vleHeadDef->Keys[vleHeadDef->Row]);

    if(curWorkPackHead == NULL)
        return;

    WorkSpace	*  selWorkSpace;
    for(int i=0; i<curWorkPackHead->m_Files.Count(); i++)
    {
        if(curWorkPackHead->m_Files[i]->GetFileName() == fileName)
        {
            selWorkSpace = curWorkPackHead->m_Files[i];
            break;
        }
    }
    m_WorkSpaceManager->DeleteWorkSpace(selWorkSpace);
    m_WorkSpaceManager->ReloadWorkSpacePack();
    WorkspaceToGUI();
}
开发者ID:eggxp,项目名称:SuperParse,代码行数:28,代码来源:FrmDesign.cpp


注:本文中的FormatStr函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。