` Printed Icetips Article

Icetips Article



Clarion in general: Dynamic strings using iDynStr interface
2003-06-25 -- Dennis E. Evans
 
Newsgroups: TopSpeed.Topic.Language

Hi all,

"Dave Harms"  wrote in message

> Can you be more specific?


A small example program and prj file are attached.

I think the IDynStr interface rates up there with Super Crunchy Peanut
Butter on pancakes, too bad there is not any documentation.

    Dennis



Project file follows at the end of the code:

teststr.clw:


    program

  include('dynstr.inc'),once

    map
      ShowCStr(*cstring)
      ShowStr(string s)
      main()
    end


DynQ    queue
dStr      &IDynStr
        end
x long
strVar   string(50)
holder   &cstring


  code
  main()
  return


main procedure()

  code

  strVar = 'This is another string'

  DynQ.dStr &= NewDynStr()
  add(DynQ)
  DynQ.dStr &= NewDynStr()
  add(DynQ)
  
  get(dynQ, 1)
  dynQ.dStr.cat('This is the first string')
  get(dynq, 2)
  dynQ.dStr.cat(strVar)
  
  loop x = 1 to records(dynq)
    get(dynq, x)
    message('just show the string in a loop ||' & dynq.dstr.str())
  end
  
  get(dynq, 1)
  ShowStr(DynQ.dStr.CStr())
  get(dynq, 2)
  ShowStr(DynQ.dStr.CStr())

  get(dynq, 1)
  ShowCStr(DynQ.dStr.CStr())
  get(dynq, 2)
  ShowCStr(DynQ.dStr.CStr())

  get(dynq, 1)
  DisposeDynStr(dynq.dStr)
  get(dynq, 2)
  DisposeDynStr(dynq.dStr)
  free(dynq)
  return

ShowCStr procedure(*cstring s)

  code
  message('inside procedure with a *cstring parameter || ' & s)
  return

ShowStr procedure(string s)

  code
  message('inside procedure with a string parameter || ' & s)
  return


-- teststr
#noedit
#system win32
#model clarion dll
#pragma debug(vid=>full)
#compile "testStr.clw"
#link "testStr.exe"



Printed April 29, 2024, 5:07 am
This article has been viewed/printed 74916 times.
Google search has resulted in 57 hits on this article since January 25, 2004.