Reading a path from a file
BlitzMax Forums/BlitzMax Beginners Area/Reading a path from a file
| ||
Why when I read a path file from a .txt file does read in string appear ‘correctly’ in the debug/output screen as: C:/pathname However, when I check what the string ‘actually’ is in debug mode it is Actually: Field String:Readinpath$ = “~qC:/pathname~q” There seems to be a problem opening the path with the ‘~qC’ pre-cursing and ending the pathname. I know I could read the string into an array and strip Off the leading and trailing 3 chars – but I’d like to know where the ‘~q’ is coming from. Is ~q related to CHR$ for speech marks ? Cheers… |
| ||
~q is the escape sequence for the quotation mark. Windows puts them usually around a path when it passes it as an agrument to the application. btw: you can usepath = path[1..path.Length - 1]to strip off the first and last character from the path. -- Byteemoz |
| ||
[a http://www.blitzwiki.org/index.php/Differences_Between_Blitz3D_and_BlitzMAX_:_Functional#Print]http://www.blitzwiki.org/index.php/Differences_Between_Blitz3D_and_BlitzMAX_:_Functional#Print[/a] This is just the debugger output finding '"' (Chr$(34)) and displaying it's escaped equivalent (~q). There is only one character there, not three. Run this... a$ = "hello" b$ = "~qhello~q" c$ = Chr$(34) + "hello" + Chr$(34) Print a$ Print b$ Print c$ DebugStop...and have a look at the debug panel. Also, it'd probably be safer to use... path$ = path$.Replace(~q, "")...in case there aren't any quotes (windows only adds quotes if there are spaces in the path, for instance). |
| ||
Thanks yan and ByteMoz... Yan your idea worked well. Cheers.. |