new conversion library is ready

General discussion on mikroPascal.
Author
Message
Briansw
Posts: 82
Joined: 28 Jul 2008 16:25

StrReplChr question

#16 Post by Briansw » 07 Jul 2009 16:09

var
text : array[8] of char;

text:=' 56789'; //has 3 spaces at beginning of string


code

StrReplChr(text,' ','0');
Lcd_Out(1,1,text);

result of this on LCD is '00000056789' but
shouldn't this be '00056789' ?


text:string[8];

Thanks
bryan

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

Re: StrReplChr question

#17 Post by janni » 07 Jul 2009 18:00

Briansw wrote: result of this on LCD is '00000056789' but
shouldn't this be '00056789' ?
It surely should if there were three spaces to be replaced. StrReplChr certainly does not add zeroes to string (BTW, it belongs to Strings lib, not conversions). Without more information I can't say what is the problem, but it's not in StrReplChr.

Briansw
Posts: 82
Joined: 28 Jul 2008 16:25

#18 Post by Briansw » 07 Jul 2009 18:36

OK, found the problem.

Even if I did this.

text:string[1];

and then this

LongintToStr(12234567,text);

LongIntToStr will resize text[1] so that the longint will fit. It will resize it to text[11]; That explains the extra 0's I'm getting. Look at the help file and it says longinttostr needs a string[11]. So it must somehow resize the string to fit the conversion. Bug in mikroep? I can load a lonngint into a string or array of 1 and display the entire longint on a LCD.

lcpoon
Posts: 11
Joined: 04 Sep 2009 11:46

#19 Post by lcpoon » 18 Sep 2009 10:39

Hi Janni,

I would like to know if your library supports MicroC PRO or not. If yes, how to include the library into my project so that I can use the functions.

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

#20 Post by janni » 18 Sep 2009 11:39

This is mikroPascal forum, so libraries presented here certainly won't work with any PRO compilers.

BUT :) , for the next PRO versions release I'm preparing a set of libraries that should work with all PRO compilers for PIC18 processors. Most of them will be official lib replacements, like strings, conversions, and floating-point math libs.

mC versions will require more work - some libs will need header files - so it'll take more time. Note also that the libs are aimed at extending mikroPascal, so behaviour of some routines may differ from known in ANSI C.

Post Reply

Return to “mikroPascal General”