Announcement

Collapse
No announcement yet.

Can someone tell me...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • mark smit
    Guest replied
    Gotcha! thanks for the reply...

    ------------------

    Leave a comment:


  • Michael Mattias
    replied
    Under Windows, many functions require a pre-initialized string, which means the string must have a length. The only way to give a string a length is to assign some characters to it. SPACE$ is handy.

    (There could be a long, drawn-out technical explanation of memory allocation and the local process workspace here, but it would put at least one of us to sleep. Just stick with the above).

    MCM


    Leave a comment:


  • mark smit
    Guest started a topic Can someone tell me...

    Can someone tell me...

    Hello all!

    Can someone tell me why so many people use SPACE$ to presize a string before a file GET or TCP RECV? Am I really supposed to do that or is this done "just in case"? If the GET/TCP RECV calls return a string of a given size then why would you need to presize the string?

    Code:
    buffer = space$(len(datablock))
    get hfile,,buffer
    
    or
    
    buffer = space$(len(datablock))
    tcp recv hsock, len(datablock), buffer
    Cheers!
Working...
X