Announcement

Collapse
No announcement yet.

putstr() writes 13 characters in a 4 characters without warning

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

  • putstr() writes 13 characters in a 4 characters without warning

    In the following code putstr() writes 13 characters in a 4 characters variable without warning
    HTML Code:
    var stringbuf[2];
    var returnString[40];
    to(stringbuf); putstr("PARAMETRIC EQ");
    
    ...
    print( [STR] stringbuf) ;
    
    gives "PARAMETRIC EQ but adjacent variable [i]returnString [/i]is "corrupted".
    Should'nt there be a warning issued by the compiler ?May be there should be a specific FORUM section for 4DGL language questions.

  • #2


    The compiler is very C like, it assumes you know what you are doing.

    May be there should be a specific FORUM section for 4DGL language questions.
    The was under the old scheme, hmm, we'll see
    Mark

    Comment


    • #3
      Ok, I'll have to be careful.

      When it comes to manipulating string, does a string class object exist only once a variable had a pointer (Pointer to string buffer) associated to it with str_Ptr(&var)?

      The following 2 codes produce a string class object pointed to by p?

      var buffer[100]; // 200 character buffer for a source stringvar p; // string pointerp := str_Ptr(buffer);//raise string pointer for the string functions
      and

      var p;
      p := "String Constant\n";


      As I understand it, String Class make it posible to store bytes in variable array of type WORD.
      If an array is created with type byte ( byte theString[10]; ) can it be used with String Class functions?




      Comment


      • #4


        I think the answer is yes.
        Mark

        Comment

        Working...
        X