IonicWind Software

Creative Basic => General Questions => Topic started by: TexasPete on May 14, 2012, 09:33:14 AM

Title: Getstartpath
Post by: TexasPete on May 14, 2012, 09:33:14 AM
DDefaultDir$=Getstartpath
I don't know why but "getstartpath" is not returning a string. Does anyone know why? I have tried reinstalling cb. This has been working in the past.
Texas Pete

Title: Re: Getstartpath
Post by: Bruce Peaslee on May 14, 2012, 09:47:33 AM
This works for me:


OpenConsole
string path$ = GetStartPath
print path$
DO: UNTIL INKEY$ <> ""
CLOSECONSOLE



Edit:  Oops. Just noticed you're using Creative Basic. Sorry.
Title: Re: Getstartpath
Post by: LarryMc on May 14, 2012, 11:53:38 AM
This works fine for me.
OpenConsole
def path$:string
path$ = GetStartPath()
print path$
DO: UNTIL INKEY$ <> ""
CLOSECONSOLE


To try and help you any further I'll need a running example of it not working to test.

LarryMc
Title: Re: Getstartpath
Post by: Bruce Peaslee on May 14, 2012, 12:40:55 PM
Quote from: Doc on May 14, 2012, 12:03:32 PM

...but it wouldn't actually display anything until I created and ran the executable.


My programs don't do anything until I run them, also; but I thought is was just me.   ::)
Title: Re: Getstartpath
Post by: LarryMc on May 14, 2012, 02:03:40 PM
Quote from: peaslee on May 14, 2012, 12:40:55 PM
Quote from: Doc on May 14, 2012, 12:03:32 PM

...but it wouldn't actually display anything until I created and ran the executable.


My programs don't do anything until I run them, also; but I thought is was just me.   ::)
I read it that way also Bruce.
Title: Re: Getstartpath
Post by: Bruce Peaslee on May 14, 2012, 08:01:26 PM
You got me, Doc. I guess the joke's on me.
Title: Re: Getstartpath
Post by: LarryMc on May 14, 2012, 08:26:27 PM
I very seldom use CBasic but when I do I always save to a file before I run it.
I've had it crash too many times and lost my code not to save it first.

So, I saved the file but did NOT create an exe file and it worked fine.

But, to me, it sort of make sense the way it works.

So, the jokes on me also, but only because of the way I always use it.

I can live with that.  ;)

LarryMc
Title: Re: Getstartpath
Post by: Doc on May 14, 2012, 09:03:16 PM
Ya know, I really don't quite understand why a person (much less two) would feel the need to make wise-cracks to someone taking a tiny few minutes out of a very busy and hectic day, when all they were doing was trying to help someone else because they actually could for once...

I guess it really doesn't matter too much, becuase I believe this is the very last of my association with any of these products.

You folks have fun. See ya.
Title: Re: Getstartpath
Post by: Bruce Peaslee on May 14, 2012, 09:25:37 PM
I'm sorry you're taking it this way. I certainly didn't mean any malice - in fact I tried to help.

You have my sincerest apologies.
Title: Re: Getstartpath
Post by: LarryMc on May 14, 2012, 10:21:42 PM
Sorry my joking hacked you off David.

You must have had a bad day. We all have them sometimes.

So, the lesson I've learned, to keep from running valued members off is:
1. Don't make jokes.
2. Stay out of the CB forums because that isn't my area of expertise.

Hate to see you go David, but if that is what you feel you have to do then good luck.

I would much prefer you reconsider and come back in a short period of time.

LarryMc
Title: Re: Getstartpath
Post by: aurelCB on May 15, 2012, 04:21:17 AM
Well...
Let someone hit me in the head with a rubber hammer if
I understand what the problem is. ???
Larry ...from my point of view there is no need for apologise at all. ;)
About what products he talks.. ???
probably he think that on other place produtcs are far better... ;D
this is a joke?
Title: Re: Getstartpath
Post by: AdrianFox on May 15, 2012, 05:08:48 AM
I am on entirely the same wavelength as AurelCB here.  I have read and re-read those comments and am completely lost as to why anybody should take offence.  I thought it was just very light humour well intentioned.
I hope our unhappy member doesn't take offence where none is intended and continues to support this friendly and helpful forum.
Title: Re: Getstartpath
Post by: Doc on May 15, 2012, 06:08:00 AM
Hey guys,
I apologize if I've taken what was intended as good natured prodding in the wrong way.
Bad day? On edge? ...you just have no idea.

Good, bad or otherwise, it still comes to mind that I'm really not much of a contributor around here, I seldom use the products anymore and am mostly just wasting time and bandwidth. I'm gonna officially give it up anyway.

Have fun, good luck and adios.

-Doc-
Title: Re: Getstartpath
Post by: TexasPete on May 15, 2012, 11:36:12 AM
Thanks Larry , Do you know why it woudl work without the parenthesis?
Thanks Philip
Title: Re: Getstartpath
Post by: aurelCB on May 15, 2012, 01:59:15 PM
I'm not sure if this help but i use this code few times:
DECLARE "kernel32",GetCurrentDirectoryA(nBufferLength:int,lpBuffer:String),int
def buffer as string
GetCurrentDirectoryA(255,buffer)
MessageBox 0,"IS:"+buffer,"OK"
Title: Re: Getstartpath
Post by: LarryMc on May 15, 2012, 02:49:13 PM
IWBasic uses
DECLARE "kernel32",GetModuleFileNameA(hmod as UINT,path as STRING,length as INT),INT
and I would think CBasic uses the same.
Title: Re: Getstartpath
Post by: TexasPete on May 17, 2012, 05:43:39 AM
Thanks for everyone replay. I believe I figured out why it was not working. I Make files of suggested solution. So I appreciate everyone's help.
Texas Pete
Title: Re: Getstartpath
Post by: GWS on May 17, 2012, 08:12:07 AM
Hi,


openconsole
cls

DDefaultDir$=Getstartpath
print DDefaultDir$

do:until inkey$<>""
closeconsole
end


... works fine for me.

The help file says:
'Returns the path to your program or executable. When your program is run from the Creative BASIC editor, this will return the path your source file is located in. When your program is in executable form, this will return the path to the executable. This provides a convenient way of specifying relative paths to data files. The path returned automatically has a "\" appended to it.'

So naturally, you need to have saved your source and/or executable to some folder for it to work.

best wishes, :)

Graham