Home » U++ Library support » U++ Core » conversion between data of a cell of the arrayctrl to int
Re: conversion between data of a cell of the arrayctrl to int [message #2566 is a reply to message #2564] |
Tue, 18 April 2006 00:19   |
 |
mirek
Messages: 14267 Registered: November 2005
|
Ultimate Member |
|
|
forlano wrote on Mon, 17 April 2006 18:11 | Hello,
to prevent the crash of my application I used the following conversion to send in the EditInt editRatNat an integer taken from a cell of the arrayctrl
editRatNat <<= atoi( AsString(arr.Get(int_row, "RatNat")) );
now it works but it was necessary to add even an
#include <cstdlib>
that has the taste of C. Now I'm not sure if atoi() can work with String or at some moment the application will crash. I've ALT+J in String.cpp to understand if AsString return a C string of something else. The result of the investigation was a nightmare .
The question: does exist a smart U++ way to produce the correct cast or what I have done is enough?
Luigi
|
First of all, best is simply to store "int" into ArrayCtrl, then you can simply write
editRatNat <<= arr.Get(int_row, "RatNat");
If this for some reason is not possible, your solution seems fine. There are U++ "atoi"s, e.g.
Value StrIntValue(const char *s);
inline int StrInt(const char* s) { return ScanInt(s); }
the important difference is that for empty input, they return Null.
Mirek
[Updated on: Tue, 18 April 2006 01:10] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Wed Sep 03 19:59:06 CEST 2025
Total time taken to generate the page: 0.05430 seconds
|