May 07, 2024, 07:46:58 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Initialize a string

Started by Andy, April 04, 2012, 05:50:31 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andy

Hi,

From difficult question to probably a simple one:

How to initialize a string

The string is defined at the TOP of the program

DEF mystring[1000]:string

The string is populated with a 1000 entries.

Is there a way to 'empty' mystring (up to a 1000 entries) without doing a

For x = 1 to 1000
mystring[ x ] = ""
Next loop  ?

Thanks,
Andy.


Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Brian

STRINGNAME[0] = NULL ?

Brian

Andy

Thanks Brian

Will try that, did you get Avast sorted?

Andy.

Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

LarryMc

the easiest is stringname="" if you are using the string in the conventional way.

If you are using it as a buffer and manipulating  it with pointers you can use the API rtlzeromemory(mystring,len(mystring)) which is what I use all the time to make sure UDT's are zeroed out.

LarryMc
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Brian

Andy,

I just knew Clever Knickers McCaughn would have a better answer than me !

But that's OK - we all learn something new every day

And, yes, I did get Avast sorted, thanks very much - it was as you pointed out

Brian

LarryMc

Quote from: Brian Pugh on April 04, 2012, 12:03:55 PM
... we all learn something new every day...
Including me.  But in my case it it usually something I learned and forgot from the day before. :o

LarryMc
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Andy

Now now ladies!  :)  :)

Larry, your first option worked - Thanks!

Any chance you could have a look at my other problem?
Entry point _ftol2 not located, but it's okay if your very busy.

The function isn't included in the MSVCRT.dll for Windows XP but is for Win 7 and Vista.

Could really do with finding a solution to this, I have a work around but it's not as good.

Thanks,
Andy.




Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.