Alpha Video Training
Results 1 to 7 of 7

Thread: Strings in A5 null terminated?

  1. #1
    "Certified" Alphaholic Marcel Kollenaar's Avatar
    Real Name
    Marcel
    Join Date
    Apr 2003
    Location
    Twente
    Posts
    1,514

    Default Strings in A5 null terminated?

    Hi,

    Are the strings under the hood of A5 null terminated like strings in the C language e.g. "abcdefg\0".

    If I declare a string buffer of a certain size do I have to include this \0 character?

    Regards,

    Marcel

  2. #2
    "Certified" Alphaholic Marcel Kollenaar's Avatar
    Real Name
    Marcel
    Join Date
    Apr 2003
    Location
    Twente
    Posts
    1,514

    Default RE: Strings in A5 null terminated?

    Hi,

    The "BLOB".SIZE() gave me an (the) answer!

    The following example shows the size as 6 because it was initialized from a six character string ("Alpha" contains an invisible NULL terminating character).

    Regards,

    Marcel

  3. #3
    Alpha Software Employee AaronBBrown's Avatar
    Real Name
    Aaron Brown
    Join Date
    Feb 2001
    Location
    Waltham, MA
    Posts
    2,836

    Default RE: Strings in A5 null terminated?

    What are you doing that requires you to declare string buffers and concern yourself with this?

  4. #4
    "Certified" Alphaholic Marcel Kollenaar's Avatar
    Real Name
    Marcel
    Join Date
    Apr 2003
    Location
    Twente
    Posts
    1,514

    Default RE: Strings in A5 null terminated?

    Aaron,

    I consult often the Microsoft Platform SDK and study the functions listed there. A lot of functions do reference at null-terminated strings. I'm still asking myself if I have to handle this or will A5 handle this when I declare a buffer.

    This is just an example of such a reference. (I know A5 has better substring functions but it is just an example.)

    "pre"lpszKey
    [in] Pointer to the null-terminated substring to be searched for. The lpszKey parameter must not exceed 65536 characters.
    "/pre"

    But I also try to find A5 functions for constructions as

    "pre"Overlapped = LocalAlloc(LMEM_ZEROINIT, sizeof(OVERLAPPED));
    "/pre"

    In this particular case I thought that I can use a blob type and handle is with its methods. In the blob I try to create a structure. What if the structure contains a string. Do I have to handle the terminating character. However this OVERLAPPED structure does not contain a string.

    Maybe I'm making it myself too difficult but I do not know all the possibilities of the Xbasic language.

    Regards,

    Marcel

  5. #5
    Alpha Software Employee AaronBBrown's Avatar
    Real Name
    Aaron Brown
    Join Date
    Feb 2001
    Location
    Waltham, MA
    Posts
    2,836

    Default RE: Strings in A5 null terminated?

    "Maybe I'm making it myself too difficult but I do not know all the possibilities of the Xbasic language."

    Yes, I think you are ;)

    Are you referring to using declare/declarestruct? If so, you just dim the variable AS C. Alpha handles the rest. I can't think of any instance where you would need to manually account for the null terminator as in C/C++.

  6. #6
    "Certified" Alphaholic Marcel Kollenaar's Avatar
    Real Name
    Marcel
    Join Date
    Apr 2003
    Location
    Twente
    Posts
    1,514

    Default RE: Strings in A5 null terminated?

    Aaron Brown wrote:
    -------------------------------
    [b]"Maybe I'm making it myself too difficult but I do not know all the possibilities of the Xbasic language."

    Yes, I think you are ;)[b]

    Thanks for the mirror. LOL

    Ok, I'll keep this in mind. I'll first study the A5 manual for a equivalent command and if I can't find it I'll knock.

    Are you referring to using declare/declarestruct? If so, you just dim the variable AS C. Alpha handles the rest.

    Yes, ok.

    I can't think of any instance where you would need to manually account for the null terminator as in C/C++.

    I don't know how I have to read this last sentence.

    1. Don't you know an instance in A5?

    or

    2. Don't you know an instance in C/C++?

    I presume 1.

    Thanks Aaron,


    Marcel

  7. #7
    Alpha Software Employee AaronBBrown's Avatar
    Real Name
    Aaron Brown
    Join Date
    Feb 2001
    Location
    Waltham, MA
    Posts
    2,836

    Default RE: Strings in A5 null terminated?

    "I don't know how I have to read this last sentence.

    1. Don't you know an instance in A5?

    or

    2. Don't you know an instance in C/C++?

    I presume 1. "


    You presume correctly.

Similar Threads

  1. Cannot Enter Certain Strings
    By Steve Andrews in forum Forum Usage
    Replies: 2
    Last Post: 09-27-2005, 11:44 AM
  2. Extracting strings from a Variable
    By John Castle in forum Alpha Five Version 5
    Replies: 10
    Last Post: 09-16-2005, 09:21 AM
  3. problem/w character strings:
    By BigMac in forum Alpha Five Version 5
    Replies: 11
    Last Post: 04-22-2004, 08:37 AM
  4. Zero Length Strings?
    By Bill Walker in forum Alpha Five Version 5
    Replies: 18
    Last Post: 01-30-2004, 04:36 AM
  5. formatting strings & word_tagged_pattern
    By Blake in forum Alpha Five Version 5
    Replies: 1
    Last Post: 08-30-2003, 03:54 PM

Bookmarks

Posting Permissions

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