指针参数传递

#include "stdafx.h"
#include <iostream>
#include <windows.h>
#include <string> 
#include <vector>
#include <time.h>
#include "shlwapi.h"
#pragma comment(lib,"shlwapi.lib")
using namespace std; 

char szPath[200] = ".\\bankcard\\";
int Step2_Create_dstCnn( char *ROIImagePath)
{		
	struct tm *newtime;
	char filename[200];
	time_t long_time;
	time(&long_time);
	newtime = localtime(&long_time);
	sprintf_s(filename,"%d-%d-%d-%d-%d-%d.jpg",newtime->tm_year+1900,newtime->tm_mon+1,newtime->tm_mday,newtime->tm_hour,newtime->tm_min,newtime->tm_sec);//
	strcat(szPath,filename);
	strcpy(ROIImagePath,szPath);
	return 1;
}
int main() 
{ 
	char szPath[MAX_PATH] = ".\\bankcard\\";

	if (!PathFileExists(szPath))
	{
		CreateDirectory( szPath, NULL );
	}	
	char ROIImagePath[100];
	memset(ROIImagePath,'\0',100);
	Step2_Create_dstCnn(ROIImagePath);//把更新后的字符串返回,即一个绝对路径
	cout<<ROIImagePath<<endl;

	
	system("pause");
	return 0; 
} 


获取当前目录路径:

char AbPath[512]; 
GetCurrentDirectory(512,AbPath);
strcat(AbPath,szPath);
strcpy(ROIImagePath,AbPath);
cvSaveImage(ROIImagePath, dst);


结果:   .\bankcard\2016-5-3-15-34-9.jpg
请按任意键继续. . .

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值