StrClear

Fills process memory used by a string variable with Null characters.

Syntax:

StrClear ( string_var )

Parameter:

(s) string_var:  a WIL variable or array element containing an ANSI, Unicode or variant BSTR string. Do not enclose the variable name in quotes.

Returns:

(i) Always returns 1.

 

StrClear erases the contents of a string variable by filling the string with null characters. After calling this function the variable or array element is treated as an empty string by the WIL interpreter. The function clears both the variable's copy of the string as well as copies of the string created by the WIL interpreter during variable assignment and accessing processing.

Note: this function does not Drop the variable or release its associated string memory to the interpreter's string reserve space. Use the Drop function or assign a new value to the variable to recycle the string memory if desired. However, dropping the variable or assigning a new variable value without first calling StrClear does not  remove the residual string contents from process memory.

Example:
  AddExtender('ilcfs44i.dll',0,'ilcfs64i.dll')
  host = 'test.example.com'
  port = 21
  user = 'demo'
    
  ; Assumes credentials set using
  ; CredMan('generic',host,User,'*topsecret*')
  creds=CredMan('read', host, 'generic')
  
  ; Create a client
  client = fsClientInit(host, port, user, creds[3], @fsFTPES)
  
  ; Clear the password from process memory
  StrClear(creds[3])
  
  ; Set a shorter timeout in case the server is busy
  ; making the script appear to hang
  fsClientSetOpt(client, 'timeout', 30)
  
  ; Upload a file to an existing directory using a new file name   
  errtext = ''
  IntControl(73,2,0,0,0)
  fsFilePut(client, 'bmp\large.galaxies.jpg', 'images\large.galaxies.jpg')
  If errtext != ''
     Pause('Upload Error', errtext)
  EndIf
  
  ; Disconnect and clean up
  fsClientDelete(client)
  Exit
  
  :WBERRORHANDLER
     If StrIndexNC(wberroradditionalinfo,'timeout', 1, @fwdscan)
        errtext = 'File upload timed out'
     Else
        errtext = wberrortextstring:@lf:wberroradditionalinfo
     EndIf
     Return
  
See Also:

CredMan, Drop, DropWild