Results 1 to 4 of 4

Thread: getstring function

  1. #1

    Thread Starter
    Frenzied Member vbgladiator's Avatar
    Join Date
    May 2001
    Posts
    1,950

    getstring function

    Hey,

    I am reading a field from a binary file and this is how I retrieve it.

    sTemp = System.Text.Encoding.ASCII.GetString(patbytes, 0, 64)
    pat.FirstName = sTemp.Trim

    patbytes contain 256 bytes which are a patient record.
    The bytes i'm getting are the first name.
    When I get the string, it is 64 chars long even after I trim it.
    The 64 is the max # of characters, but that is never the case.
    How can I retrieve just the name without the extra characters?
    When I check stemp(20), it shows me nothing, so I do not understand why trim is not getting it done.

    Thanks,
    Don't anthropomorphize computers -- they hate it

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,424

    Re: getstring function

    try
    Code:
    asc(stemp(20))
    then use
    Code:
    replace

  3. #3

    Thread Starter
    Frenzied Member vbgladiator's Avatar
    Join Date
    May 2001
    Posts
    1,950

    Re: getstring function

    I got it.
    I had to use chr(0).

    Thanks,
    Don't anthropomorphize computers -- they hate it

  4. #4
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,424

    Re: getstring function

    mark the thread resolved

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width