Page 1 of 1

Working w/ strings (again)

PostPosted: Oct 27, 2003 @ 12:06am
by egarayblas

PostPosted: Oct 27, 2003 @ 12:57am
by fzammetti
In answer to your first question:

for (int i = 0; i < 8; i++) {
displayChar(temp[i]);
}

whre displayChar is whatever function you will use to plot. The main point is that TCHAR's can be accessed just like an array of char's (actually, I might have the data type wrong here, but it's just an array, that's the point).

For the second, check out strncpy. It's not exactly the same as mid, but you should be able to just specify a pointer to the character position in your string to start copying at, and then the proper length, and you should be able to get the same effect. There is a wide-character version as well, which is probably what you need.

The answer to your third question, unless I'm missing something, is just cast to char. I believe doing (char)65 will do what you want, but how you intent to use it will probably make a difference. Putting it into a string perhaps? Something like:

TCHAR temp[5] = TEXT("1234");
temp[3] = (char)65;

I'm pretty sure that will work. Actually, I'm not even sure you need to bother casting it.

PostPosted: Oct 27, 2003 @ 1:08am
by superman

PostPosted: Oct 27, 2003 @ 2:21am
by damian

PostPosted: Oct 27, 2003 @ 6:34am
by mlepage

PostPosted: Oct 27, 2003 @ 12:46pm
by Dan East

PostPosted: Oct 27, 2003 @ 4:09pm
by egarayblas

PostPosted: Oct 28, 2003 @ 2:53am
by Dan East

PostPosted: Oct 28, 2003 @ 5:13am
by mlepage