English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. Blitz Basic

 
 
Thread Tools
Old 12 January 2023, 01:14   #1
xboxown
Registered User
 
Join Date: Dec 2012
Location: Vancouver/Canada
Posts: 676
How to separate path and file name from FileNameRequest$

Hello,

I have a command called FileRequest$ it returns both path and filename as one long string.

I could have something like this:

Work: Download/Adf/Filename.txt

or Work: Download/ADF/ <-- missing Filename.txt
or Work: Filename.txt or Work: <-- missing Filename.txt

How do I separate Filename.txt from the path and put each in their separate string holder?

Thanks in advance.
xboxown is offline  
Old 12 January 2023, 01:59   #2
James
Registered User
 
Join Date: Mar 2010
Location: Beckenham/England
Posts: 796
Pathpart and filepart:

https://aminet.net/package/util/cli/0Utils

or

https://aminet.net/package/util/batch/MoreCLI1.2

One set didn't work for me, think it was the ones from MoreCLI, but can't remember for sure...
James is offline  
Old 12 January 2023, 04:16   #3
xboxown
Registered User
 
Join Date: Dec 2012
Location: Vancouver/Canada
Posts: 676
Erm...no...I am asking for blitzbasic source code not a third party application utilities.
xboxown is offline  
Old 12 January 2023, 13:11   #4
Honitos
Registered User
 
Honitos's Avatar
 
Join Date: Nov 2019
Location: Celle / Germany
Posts: 145
The Mid$()-function is your friend.
You can parse the string for yourself from right to left and Split the string.
Honitos is offline  
Old 12 January 2023, 13:40   #5
malko
Ex nihilo nihil
 
malko's Avatar
 
Join Date: Oct 2017
Location: CH
Posts: 4,896
Long time not touched Blitz but if there is no in-box function for that I think the best is :
1) find the ":" (you get the drive name before)
2) find the last "/" (you get the filename after)
3) everything in between is the path.
malko is offline  
Old 12 January 2023, 13:45   #6
Honitos
Registered User
 
Honitos's Avatar
 
Join Date: Nov 2019
Location: Celle / Germany
Posts: 145
Asking for source, there is of course the include "DOS.include.ab3" that contains proper functions in AmiBlitz3.
Honitos is offline  
Old 17 January 2023, 17:36   #7
Daedalus
Registered User
 
Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,351
For completeness (I answered this elsewhere), there are also the FilePart$() and PathPart$() functions in one of the standard 3rd party libraries (ElmoreDOSLib IIRC). It's likely they just call the dos.library functions anyway, but in a Blitz-friendly way.
Daedalus is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
set script path as relative path Tolgod Coders. Scripting 3 05 November 2021 13:08
Include file path priorities for assemblers phx Coders. General 20 07 July 2020 16:30
Picasso iV ROM file path PeterK support.WinUAE 11 01 April 2018 02:00
Use file requester to specify path in Shell? Foebane support.Apps 5 01 January 2017 15:32
Separate PPC mritter0 support.WinUAE 8 18 September 2014 00:56

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 23:54.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.08233 seconds with 13 queries