`
rothmada
  • 浏览: 84139 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论
收藏列表
标题 标签 来源
C++ 获取当前路径 c++
#include <iostream>
#include <windows.h>
#include <string>

using namespace std;

int main()
{
 char buf[1000];
 int i=1000;

 GetCurrentDirectory(1000,buf);  //得到当前工作路径,跟字符集有关系GetCurrentDirectoryA

 cout<<buf<<endl;

 char strModule[256];
 GetModuleFileName(NULL,strModule, 256); //得到当前模块路径

 cout<<strModule<<endl;

 string a;
  a.assign(buf);
 cout<<a<<endl;
  a.append("\\..\\");     //设置为当前工作路径为当时的上一级

 //a=a+"..\\";
 SetCurrentDirectory(a.c_str());  //设置

 GetCurrentDirectory(1000,buf);
 cout<<buf<<endl;

 return 0;
}
报错信息
LDR: LdrpWalkImportDescriptor() failed to probe C:\Qt\4.7.3\bin\QtCored4.dll for its manifest, ntstatus 0xc0150002
Debugger:: An unhandled non-continuable exception was thrown during process load
The program '[3288] qt2.exe: Native' has exited with code -1072365566 (0xc0150002).
DataSet
	public IDataSet combineDataSet(String... locations) throws Exception {
		IDataSet[] datasets = getDataSets(locations);
		CompositeDataSet dataSet = new CompositeDataSet(datasets, true, true);
		return dataSet;
	}
	
	public Resource[] getResources(String...locations) throws IOException {
		List<Resource> resources = new ArrayList<Resource>();
		for(String location: locations) {
			Resource[] rs = applicationContext.getResources(location);
			for(Resource resource : rs) {
            	if(!resource.exists()) {
            		logger.warn("Resource '{}' can't read, ignore it.", resource);
            		continue;             	}
            	resources.add(resource);
			}
		}
		return resources.toArray(new Resource[resources.size()]);
	}


         protected IDataSet[] getDataSets(String... locations) throws Exception {
		FlatXmlDataSetBuilder builder = new FlatXmlDataSetBuilder();
		builder.setCaseSensitiveTableNames(false);
		builder.setColumnSensing(true);
		List<IDataSet> resources = new ArrayList<IDataSet>();
		for(Resource resource : getResources(locations)) {
			resources.add(builder.build(resource.getInputStream()));
		}
		return resources.toArray(new IDataSet[resources.size()]);
	}
public void export(String locations, String tablename) throws DataSetException, FileNotFoundException, IOException, SQLException {		
		QueryDataSet dbDataSet = new QueryDataSet(connection);
		dbDataSet.addTable(tablename);
		FlatXmlDataSet.write(dbDataSet, new FileOutputStream(locations));
	}
xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:p="http://www.springframework.org/schema/p"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:util="http://www.springframework.org/schema/util"
	xmlns:sec="http://www.springframework.org/schema/security"
	xsi:schemaLocation="http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
		http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd
		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">

	<context:property-placeholder location="file:${user.home}/orchid-config/orchid-test.properties" 
		ignore-unresolvable="true" ignore-resource-not-found="true" />

	<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
		p:driverClassName="oracle.jdbc.pool.OracleDataSource" p:url="${jdbc.url}"
		p:username="${jdbc.username}" p:password="${jdbc.password}" init-method="createDataSource"
		destroy-method="close" />
		
	<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate"
		p:dataSource-ref="dataSource">
	</bean>	
	
	<bean id="dbunitDataPopulator" class="com.supcon.orchid.container.testing.DBUnitDataPopulator"
	 p:dataSource-ref="dataSource" p:databaseType="${database.type}" p:databaseSchema="${jdbc.username}"/>
	
	<!-- similarly, don't forget the PlatformTransactionManager 	-->
	<bean id="transactionManager"
		class="org.springframework.orm.hibernate3.HibernateTransactionManager"
		p:sessionFactory-ref="sessionFactory">
	</bean>	
 	
	<util:list id="deploymentProviders"></util:list>
	
</beans>
Global site tag (gtag.js) - Google Analytics