Jump to content

[SOLVED] Problem parsing application arguments in Windows


photo

Recommended Posts

Posted

Hi all,

my problem is I'm not able to convert input parameters from command line arguments. This is the code sample:

#include <samples/systems/common/systems.h>

/*
 */
void update_scene() { ; }

/*
 */
void create_scene() {

	forloop(int i=0 ; engine.getNumArgs()) {
		if(engine.getArg(i) == "--msg") {
			log.message("param:%s", engine.getArg(i+1));
			break;
		}
	}
	
	return "Application arguments";
}

/*
 */
void clear_scene() {
	
}

If I run the sample with the following arguments:

main_x86.exe -engine_config ..\data\unigine.cfg -console_command "world_load samples\systems\arguments" --msg cañón

I get the wrong representation of the argument, so in the log file appears:

18:13:10 param:ca��n (instead of cañón)

 

I suppose it's because wndows input parameters are codified in a different way that Unigine interprets it (Utf-8)

 

How can I convert this string argument to Utf-8?

 

I don't have this problem in OSX and Linux because they always work in Utf-8.

 

Thanks in advance,

Iván.

 

 

 

Posted

Hi uncleboob,

At the end I made it work with using a .bat file and codepage 1252.

 

Thanks.

×
×
  • Create New...