Announcement

Collapse
No announcement yet.

main arguments

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

  • main arguments

    Hello,

    I'm using the file_Exec instruction.
    Great !
    So, the example provided with file_Exec runs OK.
    In this example, arguments are integer.

    Is it possible to pass string ?

    Thanks a lot.

    Joel Petrique

  • #2


    Hi Joel, yes you can pass a pointer to an integer array which can be holding a packed string. So the calling program can pass a pointer to an array, the called program can then use it, or modify it as required.
    Regards,
    Dave

    Comment


    • #3
      Hum, well, Meldavia... Thanks a lot... But it doesn't run... What do I wrong ?
      I tried some code, without any success. The last I tried is :

      1) in a file named "file_Ex.4FN" on the card :
      func main (var param)
      txt_Set (TEXT_COLOUR, YELLOW);
      txt_Set (FONT_SIZE, 2);
      txt_MoveCursor (10, 0);
      print (param, "\n"); // CALLED1
      print ([STR]param, "\n"); // CALLED2
      txt_Set (TEXT_COLOUR, GREEN);
      return 123;
      endfunc

      2) in the calling program :
      var arg[2], s[40];

      func main ()
      var retour;
      to (s); print ("Essai de chaines", "\n");
      arg[0] := 1;
      arg[1] := s;
      print (s, "-", [STR]s, "\n"); // MAIN1
      retour := file_Exec ("file_ex.4FN", arg);
      print ("\nPrincipal, retour : ", retour, "\n"); // MAIN2

      repeat
      forever
      endfunc

      The display is
      MAIN1 3-Essai de chaines // correct
      CALLED1 3 // just the address in param
      CALLED2 (nothing) // why nothing ?
      MAIN2 Principal, retour : 123 // correct, the value returned

      I tried to use the str_Ptr function, without any success...
      What's wrong ?
      Thanks a lot.

      Joel


      Comment

      Working...
      X