• Pascal Question number... ?

    From Black Panther@21:1/186 to All on Tue Aug 14 18:32:16 2018
    Hi All,

    I have yet another pascal question to ask... :) I promise, it's a simple one.

    In my programs, I've been using this for the path delimiter. eg:

    assignfile(datfile,path+PathDelim+'example.txt');

    While looking at some others code, I've noticed they will use something like:

    {$IFDEF WIN32}
    PathChar = '\';
    {$ENDIF}
    {$IFDEF LINUX}
    PathChar = '/';
    {$ENDIF}

    My question, is one way better than the other? I haven't had any issues with using the PathDelim that I've noticed. It looks, to me at least, as though it would be personal preference. I'm just not sure if I'm correct.

    (See, I told you it was an easy question this time...) ;)

    Thanks,


    ---

    Black Panther
    a.k.a. Dan Richter
    Sysop - Castle Rock BBS (RCS)
    telnet://bbs.castlerockbbs.com
    http://www.castlerockbbs.com
    The sparrows are flying again....

    --- Mystic BBS v1.12 A39 2018/04/21 (Linux/64)
    * Origin: Castle Rock BBS - bbs.castlerockbbs.com (21:1/186)
  • From Rushfan@21:2/115 to Black Panther on Wed Aug 15 00:41:38 2018
    RE: Re: Pascal Question number... ?
    BY: Black Panther(21:1/186)

    My question, is one way better than the other? I haven't had any issues with
    using the PathDelim that I've noticed. It looks, to me at least, as
    though it
    would be personal preference. I'm just not sure if I'm correct.

    (See, I told you it was an easy question this time...) ;)

    If you see those ifdefs then it means someone hadn't read http://wiki.freepascal.org/Multiplatform_Programming_Guide or copied that code from someone who hadn't read it.

    Use PathDelim, it's easier and if freepascal is ported to some new platofrm that uses : as separators, it'll work.

    Rushfan

    --- WWIV 5.4.0.development
    * Origin: Mystic Rhythms BBS (21:2/115)
  • From Black Panther@21:1/186 to Rushfan on Tue Aug 14 20:20:36 2018
    On 08/15/18, Rushfan said the following...

    My question, is one way better than the other? I haven't had any issue using the PathDelim that I've noticed. It looks, to me at least, as

    If you see those ifdefs then it means someone hadn't read http://wiki.freepascal.org/Multiplatform_Programming_Guide or copied
    that code from someone who hadn't read it.

    That was kinda my thoughts as well. I've spent many hours on the
    freepascal.org website over the last months... :) Great resource!

    Use PathDelim, it's easier and if freepascal is ported to some new platofrm that uses : as separators, it'll work.

    I started using PathDelim when I wanted to port from Linux to Windows. It's made life so much easier.

    Thanks.


    ---

    Black Panther
    a.k.a. Dan Richter
    Sysop - Castle Rock BBS (RCS)
    telnet://bbs.castlerockbbs.com
    http://www.castlerockbbs.com
    The sparrows are flying again....

    --- Mystic BBS v1.12 A39 2018/04/21 (Linux/64)
    * Origin: Castle Rock BBS - bbs.castlerockbbs.com (21:1/186)
  • From Rushfan@21:2/115 to Black Panther on Wed Aug 15 03:35:06 2018
    RE: Re: Pascal Question number... ?
    BY: Black Panther(21:1/186)

    I started using PathDelim when I wanted to port from Linux to Windows.
    It's
    made life so much easier.

    Ya, on WWIV i made a function FilePath(dir, file) that handled all of that for me, since at first the path issues were killing me... Now I'm thinking I'll actually make that from a method that returns a string into a class (called FilePath) so the code will be the same but I can guarantee all of my File methods take a sanitized FilePath. I think I can also handle the operator(std::string) case to coerce it magically into a string as needed...

    Rushfan

    --- WWIV 5.4.0.development
    * Origin: Mystic Rhythms BBS (21:2/115)
  • From xqtr@21:1/111 to Black Panther on Sat Aug 11 05:32:48 2018
    While looking at some others code, I've noticed they will use something like:
    {$IFDEF WIN32}
    PathChar = '\';
    {$ENDIF}
    {$IFDEF LINUX}
    PathChar = '/';
    {$ENDIF}

    If you want to stay 100% on FreePascal use PathDelim, you will be more compatible with future versions and also cross compile in all FreePascal platforms and not only windows and linux.

    I also use the above code, because its easier for me to remember the word pathchar instead of pathdelim and because i stay on windows/linux platforms only.

    .----- --- -- -
    | Another Droid BBS
    : Telnet : andr01d.zapto.org:9999 [UTC 11:00 - 20:00]
    . Contact : xqtr@gmx.com

    --- Mystic BBS v1.12 A39 2018/04/21 (Raspberry Pi/32)
    * Origin: Another Droid BBS (21:1/111)
  • From Black Panther@21:1/186 to xqtr on Sat Aug 18 12:44:30 2018
    On 08/11/18, xqtr said the following...

    {$IFDEF WIN32}
    PathChar = '\';
    {$ENDIF}
    {$IFDEF LINUX}
    PathChar = '/';
    {$ENDIF}

    If you want to stay 100% on FreePascal use PathDelim, you will be more compatible with future versions and also cross compile in all FreePascal platforms and not only windows and linux.

    I've been using the PathDelim, just because it was on the freepascal.org website. (I love the site)

    I also use the above code, because its easier for me to remember the word pathchar instead of pathdelim and because i stay on windows/linux platforms only.

    I also use the compiler directives as well, but for different reasons. I'm using them to set the operating system and whether it's 32 or 64bit.

    Thanks,


    ---

    Black Panther
    a.k.a. Dan Richter
    Sysop - Castle Rock BBS (RCS)
    telnet://bbs.castlerockbbs.com
    http://www.castlerockbbs.com
    The sparrows are flying again....

    --- Mystic BBS v1.12 A39 2018/04/21 (Linux/64)
    * Origin: Castle Rock BBS - bbs.castlerockbbs.com (21:1/186)
  • From Vk3jed@21:1/109 to Black Panther on Sun Aug 19 09:45:00 2018
    On 08-18-18 12:44, Black Panther wrote to xqtr <=-

    I've been using the PathDelim, just because it was on the
    freepascal.org website. (I love the site)

    I must get back into FreePascal. I dabbled a bit last year and Pascal started coming back to me. I like the fact that FreePascal is available for all the popular platforms.

    I also use the compiler directives as well, but for different reasons.
    I'm using them to set the operating system and whether it's 32 or
    64bit.

    Cool. :)


    ... A fast has no real nutritional value.
    === MultiMail/Win v0.51
    --- SBBSecho 3.03-Linux
    * Origin: Freeway BBS Bendigo,Australia freeway.apana.org.au (21:1/109)
  • From Black Panther@21:1/186 to Vk3jed on Sat Aug 18 20:52:38 2018
    On 08/19/18, Vk3jed said the following...

    I've been using the PathDelim, just because it was on the freepascal.org website. (I love the site)

    I must get back into FreePascal. I dabbled a bit last year and Pascal started coming back to me. I like the fact that FreePascal is available for all the popular platforms.

    It's available for all the popular platforms, but can be a pain to try to set up cross-compiling from one system... I finally got it to compile both Linux
    64 and 32 bit. I still have to transfer the code to the Windows system to compile that version...

    For me, it seems as though Pascal is a very simple language to use. I did try using C and C++ at one time, but the syntax felt cryptic. I was able to
    muddle my way through it, but Pascal just seemed like the syntax just made sense...

    I also use the compiler directives as well, but for different reasons I'm using them to set the operating system and whether it's 32 or 64bit.

    Cool. :)

    It took me a little bit to get it figured out, but It seems to work. :) It's something that really isn't *needed* for my programs, but it's a nice touch...


    ---

    Black Panther
    a.k.a. Dan Richter
    Sysop - Castle Rock BBS (RCS)
    telnet://bbs.castlerockbbs.com
    http://www.castlerockbbs.com
    The sparrows are flying again....

    --- Mystic BBS v1.12 A39 2018/04/21 (Linux/64)
    * Origin: Castle Rock BBS - bbs.castlerockbbs.com (21:1/186)
  • From apam@21:1/101 to Black Panther on Sun Aug 19 15:57:30 2018
    For me, it seems as though Pascal is a very simple language to use. I
    did try using C and C++ at one time, but the syntax felt cryptic. I was able to muddle my way through it, but Pascal just seemed like the syntax just made sense...

    I learned Pascal before I learned C. I think I was about 13-14 or something
    and my uncle said better to learn C. Was always afraid of it because I came from BASIC and C was what the pros used. So I got a book and sat down and learned it from the book (Teach yourself C in 24 hours or something). Now to
    me Pascal seems strange. To me C is much simpler, but required a bit more effort to do things (than say C++ which now you have things like qsort as
    part of the standard library).

    Once you get the hang of the basics in C, the rest is pretty easy you just
    have to break down things. Like eating an elephant, one bite at a time :)

    Andrew

    --- Mystic BBS v1.12 A39 2018/04/21 (Windows/32)
    * Origin: Agency BBS | Dunedin, New Zealand | agency.bbs.nz (21:1/101)
  • From Black Panther@21:1/186 to apam on Sat Aug 18 22:38:10 2018
    On 08/19/18, apam said the following...

    I learned Pascal before I learned C. I think I was about 13-14 or something and my uncle said better to learn C. Was always afraid of it

    When I first learned Pascal, I think I was 15. That was Apple Pascal on a IIe... (Boy I feel old...)

    because I came from BASIC and C was what the pros used. So I got a book and sat down and learned it from the book (Teach yourself C in 24 hours
    or something). Now to me Pascal seems strange. To me C is much simpler,

    I did a little be with BASIC. The best thing about it was the GOTO statements... :)

    I've actually got a book right here. A First Book of C++. That's what helped
    me when I was working with C/C++.

    I've been thinking about trying to learn C again, as there are many more resources available for it, than Pascal. It seems that most of the newer languages are going to more of a scripting style, than compiled. I still
    prefer the compiled. (nobody can see how bad your code looks) ;)

    but required a bit more effort to do things (than say C++ which now you have things like qsort as part of the standard library).

    Really! I didn't know that. Perhaps it's time to start looking at C/C++ again...

    Once you get the hang of the basics in C, the rest is pretty easy you
    just have to break down things. Like eating an elephant, one bite at a time :)

    I think that's with any language. For me, it would just be learning a new syntax and format.

    My question is, why would you want to eat an elephant... I've never been that hungry... ;)


    ---

    Black Panther
    a.k.a. Dan Richter
    Sysop - Castle Rock BBS (RCS)
    telnet://bbs.castlerockbbs.com
    http://www.castlerockbbs.com
    The sparrows are flying again....

    --- Mystic BBS v1.12 A39 2018/04/21 (Linux/64)
    * Origin: Castle Rock BBS - bbs.castlerockbbs.com (21:1/186)
  • From Vk3jed@21:1/109 to Black Panther on Sun Aug 19 21:39:00 2018
    On 08-18-18 20:52, Black Panther wrote to Vk3jed <=-

    It's available for all the popular platforms, but can be a pain to try
    to set up cross-compiling from one system... I finally got it to
    compile both Linux 64 and 32 bit. I still have to transfer the code to
    the Windows system to compile that version...

    Yeah I've got it installed, just haven't got back to relearning, though I did do a simple tutorial from the FPC website and it all started coming back. :)

    For me, it seems as though Pascal is a very simple language to use. I
    did try using C and C++ at one time, but the syntax felt cryptic. I was able to muddle my way through it, but Pascal just seemed like the
    syntax just made sense...

    Yeah I started on C ages ago but never got anywhere. I always liked Pascal and found it easy to work with too. Used to be quite good at Pascal (Turbo Pascal) back in the day. :)

    I also use the compiler directives as well, but for different reasons I'm using them to set the operating system and whether it's 32 or 64bit.

    Cool. :)

    It took me a little bit to get it figured out, but It seems to work. :) It's something that really isn't *needed* for my programs, but it's a
    nice touch...

    Yep. :)

    My biggest problem nowadays is me lol. I'm getting less suited to sitting down and coding as I get older, I need to be doing physical stuff too much LOL


    ... The word 'meaningful' when used today is nearly always meaningless.
    === MultiMail/Win v0.51
    --- SBBSecho 3.03-Linux
    * Origin: Freeway BBS Bendigo,Australia freeway.apana.org.au (21:1/109)
  • From Vk3jed@21:1/109 to Black Panther on Sun Aug 19 22:05:00 2018
    On 08-18-18 22:38, Black Panther wrote to apam <=-

    On 08/19/18, apam said the following...

    I learned Pascal before I learned C. I think I was about 13-14 or something and my uncle said better to learn C. Was always afraid of it

    When I first learned Pascal, I think I was 15. That was Apple Pascal on
    a IIe... (Boy I feel old...)

    I was about the same age but I learned Turbo Pascal on CP/M (using a Z80 card in an Apple //e). :) A few years later when I went to university, transitioning to TP on DOS was dead simple. :)

    I've been thinking about trying to learn C again, as there are many
    more resources available for it, than Pascal. It seems that most of the newer languages are going to more of a scripting style, than compiled.
    I still prefer the compiled. (nobody can see how bad your code looks)
    ;)

    I went down the scripting route using BASH scripting. :) Dabbled a little in Perl, but haven't tried Python yet.

    I think that's with any language. For me, it would just be learning a
    new syntax and format.

    Those are the things I find the most brain intensive. :( And the ones I have to do in the smallest doses now.

    My question is, why would you want to eat an elephant... I've never
    been that hungry... ;)

    lol. :)


    ... Trilogy (n). Series of three books, sometimes more.
    === MultiMail/Win v0.51
    --- SBBSecho 3.03-Linux
    * Origin: Freeway BBS Bendigo,Australia freeway.apana.org.au (21:1/109)