| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | There`s gotta be an easi |
I was working on a program recently which involved the following:
target is a pointer to a structure containing a group of 10 cstrings.
That group is called info.
2 of the 10 cstrings contain the representation of a number.
I must divide these numbers by 10.
I then must place that value back into the cstring (where I originally
got it).
It seems to me as though there HAS to be an easier way of doing this
than the way I did it.
Suggestions anyone.
void CWmaillstDlg::divide_by_ten(config_info * target)
{
int first = atoi(target->info[1]);
int second = atoi(target->info[3]);
first /= 10;
second /= 10;
char firststr[10]={0}, secondstr[10]={0};
pchar unused = itoa(first, firststr, 10);
unused = itoa(second, secondstr, 10);
target->info[1] = firststr;
target->info[3] = secondstr;
}
þ CMPQwk 1.42 999
--- Maximus/2 3.01
* Origin: COMM Port OS/2 juge.com 204.89.247.1 (281) 980-9671 (1:106/2000)SEEN-BY: 633/267 270 @PATH: 106/2000 1 379/1 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.