Console app in VS Express C

aCynic2

Senior member
Apr 28, 2007
710
0
0
Ok, I'm evaluating VS Express.

I need to specify a commandline to my console app (it won't run without it). I'm not familiar with VS Express. Where do I find this option?
 

Tencntraze

Senior member
Aug 7, 2006
570
0
0
I don't have the express edition, but I imagine it's the same. You need to go to the project properties and then the Debug tab; from here, you should see a 'Command line arguments' section.
 

aCynic2

Senior member
Apr 28, 2007
710
0
0
I found it, after some diligent searching, but now I've run into a new problem. I'm not sure what the failure is, but I'm trying to rewrite my program for VS Express and trying to take advantage of the "safe" versions of string functions:

void disp_error(char *errstr, char *file, int line)
{
char errmsg[128];

_strnset_s( errmsg, 128, 0, 128); <== assertion failure!

sprintf_s( errmsg, 128, "ERROR: %s, file: %s, line: %d\n", errstr, file, line );
puts( errmsg );
}

I don't know why this is failing. I've tried sizeof(errmsg) and as you can see, the last attempt is using a hard coded 128. I'm not even sure what the assertion is testing, because it doesn't mean squat! It says:

Expression: (L"String not null terminated" && 0)

I'm trying to NUL the entire string to prevent problems of non-terminated strings. So, how the f do I do it under VS Express?

 

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Oct 30, 2000
42,589
5
0
char errmsg[128] = {128 * 0x00};

or

memset (errmsg,0,128);
 

aCynic2

Senior member
Apr 28, 2007
710
0
0
Thank you Eagle. I am accustomed to using memset to zero out my strings, but I'm still not quite there to using wide character strings yet. All the stuff I'm making now it intended to be internal. The next phase will likely require it.

I'm going to have extreme difficulty with VS Express. I can see it now.