Power Script

Power Script

I am reading in an external data file using i_file = fileopen (“c:dataamt.dat”, linemode!,read!)

	fileread (i_file, filelines)		fileclose (i_file)

How would you avoid hardcoding the data file so that at program start-up, it would pull the files from the default path installation?

You can use the following API call to work out the current path:

Function ulong GetCurrentDirectoryA (ulong textlen, ref string dirtext) library "KERNEL32.DLL"

Then call the API call with PowerScript like:

String ls_DirIF ienv_ENV.win16 THEN RETURN ""ls_dir = Space( 255 )GetCurrentDirectoryA( 255, ls_dir )IF Len( ls_dir ) > 1 AND Right( ls_Dir , 1 )  "" THEN ls_Dir += ""RETURN ls_Dir


Share the Post: