{"id":222,"date":"2009-04-07T23:33:32","date_gmt":"2009-04-08T07:33:32","guid":{"rendered":"http:\/\/xiehang.com\/blog\/?p=222"},"modified":"2009-04-30T18:13:35","modified_gmt":"2009-05-01T02:13:35","slug":"language-feature-is-better-than-os","status":"publish","type":"post","link":"https:\/\/xiehang.com\/blog\/2009\/04\/07\/language-feature-is-better-than-os\/","title":{"rendered":"Language feature is better than OS"},"content":{"rendered":"

I was trying to figure out how to load a file from the path where the executable stays, the first thing came to my mind is using Win32’s GetCommandLine, and then do GetFullPathName. It seems ideal in C\/C++ world but obviously things don’t work quite well in Ada, especially delimiter changed from \/ to and then changed back, I have no idea what does Ada’s run-time library is doing.<\/p>\n

Then I found Ada has this package – Ada.Directories, it is actually what I want. Using GetCommandLine to get the executable’s full path name, and use Ada.Directories.Containing_Directory to get the directory, all set.<\/p>\n

This got me recall similar things in C\/UNIX, though UNIX API can do whatever I want, it is usually convenience to use C functions as it fit the language well. Things are getting worse with Ada on Windows, since we all know Windows was not developed by Ada …<\/p>\n

BTW, Ada’s identifier is really long, and actually this is the style I’m trying to follow.<\/p>\n","protected":false},"excerpt":{"rendered":"

I was trying to figure out how to load a file from the path where the executable stays, the first thing came to my mind is using Win32’s GetCommandLine, and then do GetFullPathName. It seems ideal in C\/C++ world but obviously things don’t work quite well in Ada, especially delimiter changed from \/ to and […]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[4,6],"_links":{"self":[{"href":"https:\/\/xiehang.com\/blog\/wp-json\/wp\/v2\/posts\/222"}],"collection":[{"href":"https:\/\/xiehang.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xiehang.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xiehang.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xiehang.com\/blog\/wp-json\/wp\/v2\/comments?post=222"}],"version-history":[{"count":3,"href":"https:\/\/xiehang.com\/blog\/wp-json\/wp\/v2\/posts\/222\/revisions"}],"predecessor-version":[{"id":224,"href":"https:\/\/xiehang.com\/blog\/wp-json\/wp\/v2\/posts\/222\/revisions\/224"}],"wp:attachment":[{"href":"https:\/\/xiehang.com\/blog\/wp-json\/wp\/v2\/media?parent=222"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xiehang.com\/blog\/wp-json\/wp\/v2\/categories?post=222"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xiehang.com\/blog\/wp-json\/wp\/v2\/tags?post=222"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}