| 446 | |
| 447 | |
| 448 | ILboolean GetCardInt(char *Buffer, ILint *Val) |
| 449 | { |
| 450 | ILuint i; |
| 451 | char ValString[22]; |
| 452 | |
| 453 | if (Buffer[7] != '=' && Buffer[8] != '=') |
| 454 | return IL_FALSE; |
| 455 | for (i = 9; i < 30; i++) { |
| 456 | if (Buffer[i] != ' ' && Buffer[i] != 0) // Right-aligned with ' ' or 0, so skip. |
| 457 | break; |
| 458 | } |
| 459 | if (i == 30) // Did not find the integer in positions 10 - 30. |
| 460 | return IL_FALSE; |
| 461 | |
| 462 | //@TODO: Safest way to do this? |
| 463 | memcpy(ValString, &Buffer[i], 30-i); |
| 464 | ValString[30-i] = 0; // Terminate the string. |
| 465 | |
| 466 | //@TODO: Check the return somehow? |
| 467 | *Val = atoi(ValString); |
| 468 | |
| 469 | return IL_TRUE; |
| 470 | } |
| 471 | |
| 472 | #endif//IL_NO_FITS |