Ecere SDK/eC Forums
https://ec-lang.org/community/
Print view

String Property issue
https://ec-lang.org/community/viewtopic.php?f=1&t=204
Page 2 of 2
Author:  samsam598 [ Thu Oct 13, 2011 1:34 am ]
Post subject:  Re: String Property issue

Also I can't help but suggest you use the Ecere functions instead of the WinSock API directly, to fulfill Ecere's aspiration for cross-platform applications:

GetAddressFromName, GetNameFromAddress and GetHostName will help you do what you're doing here with much ease.
I tried the sample code from the sample eCom but I got blank strings for hostName and hostAddress.Was I missing something?

Code: Select all

 
Button button1
   {
      this, text = "button1", position = { 184, 112 };
 
      bool NotifyClicked(Button button, int x, int y, Modifiers mods)
      {
         char hostName[256], address[64];
         GetHostName(hostName, sizeof(hostName));
         GetAddressFromName(hostName, address); 
         MessageBox{contents=hostName}.Modal();
         MessageBox{contents=address}.Modal();    
         return true;
      }
   };          
 
 
Author:  jerome [ Thu Oct 13, 2011 2:10 am ]
Post subject:  Re: String Property issue

Sam, good catch!

It seems that the networking system needs to be initialized first for these functions to work.
An easy way is by declaring a global Service or Socket object:

Code: Select all

Socket socket { };
That will get them to work.
Would you please file a Mantis bug report? :)

Thanks!

-Jerome
Author:  samsam598 [ Thu Oct 13, 2011 4:13 am ]
Post subject:  Re: String Property issue

Done!
http://ecere.com/mantis/view.php?id=655

It is 2am at your side,right?Please take good care of yourselve.We are looking forward to the updates and improvements of ec SDK! :)
All times are UTC-05:00 Page 2 of 2