QB64 Phoenix Edition
Chat with Me -- HOST - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: Chatting and Socializing (https://qb64phoenix.com/forum/forumdisplay.php?fid=11)
+--- Forum: General Discussion (https://qb64phoenix.com/forum/forumdisplay.php?fid=2)
+--- Thread: Chat with Me -- HOST (/showthread.php?tid=1262)

Pages: 1 2 3 4 5 6 7


RE: Chat with Me -- HOST - Pete - 12-14-2022

See for yourself:
 
Code: (Select All)
PRINT "D:\" + " + "Program Files" + " + "\Notepad++\notepad++.exe tmp.three"

vs...

Code: (Select All)
PRINT "D:\" + CHR$(34) + "Program Files" + CHR$(34) + "\Notepad++\notepad++.exe tmp.three"

Without using CHR$(34) your other quote marks make no difference. The system just concatenates the strings and concatenation does not include quote marks, unless you code them as CHR$(34).

Pete


RE: Chat with Me -- HOST - Kernelpanic - 12-14-2022

(12-14-2022, 10:52 PM)Pete Wrote: See for yourself:
 
Code: (Select All)
PRINT "D:\" + " + "Program Files" + " + "\Notepad++\notepad++.exe tmp.three"

vs...

Code: (Select All)
PRINT "D:\" + CHR$(34) + "Program Files" + CHR$(34) + "\Notepad++\notepad++.exe tmp.three"

Without using CHR$(34) your other quote marks make no difference. The system just concatenates the strings and concatenation does not include quote marks, unless you code them as CHR$(34).

Pete

Thanks! I will look at that tomorrow. Oops, it's already morning. But I think I have drunk a glass of wine too many  Tongue - so this afternoon.


RE: Chat with Me -- HOST - SMcNeill - 12-14-2022

Shell "D:\" + " + "Program Files" + " + "\Notepad++\notepad++.exe tmp.three"

Look at what you have here, piece by piece.

"D:\" +    <-- String plus
" + "  +    <-- another string plus
Program Files" + " +   <--  WTH??  What's the IDE supposed to do with this?  

Just follow the quotes and you can see what's in a string and what isn't.  Smile


RE: Chat with Me -- HOST - Pete - 12-15-2022

Steve, what he tried to do is a substitution of CHR$(34) with the quote mark in the code. See below...

Shell "D:\" + " + "Program Files" + " + "\Notepad++\notepad++.exe tmp.three"

                    ^                               ^

When he runs what I posted, he will see how QB64 treats the quote symbol vs CHR$(34) differently during the concatenation process.

Acapulco is nice this time of the year. Hey wait, this is a paid Keyword of the Day vacation, right? Huh

Pete


RE: Chat with Me -- HOST - SMcNeill - 12-15-2022

Aye.  I know what he tried to do.  I just wanted him to see what he actually did.  Wink


RE: Chat with Me -- HOST - TempodiBasic - 12-15-2022

the file got with Pete's code has been rightly opened by notepad  (be aware NO notepad++) that is in the general path of windows.
If you make a setpath enviromment for notepad++ you should solve the path issue for opening the file of configuration IP.


RE: Chat with Me -- HOST - mnrvovrfc - 12-15-2022

(12-14-2022, 10:44 PM)Kernelpanic Wrote: The CHR$(34) function stands for the Ascii character >"<. If I now replace CHR$(34) with the relevant character, the error message below appears - see screenshot.
Is it correct that CHR$(34) is only intended to prevent >"< from being criticized as already existing?

We would need a way to "escape" a character which is difficult to rein in. Freebasic could do it with CHR$(34), but QB64(PE) cannot. It's historical. Part of the frustration is unable to do this:

Code: (Select All)
CONST qu = CHR$(34)

This whether or not the "variable" carries a dollar sign.

In Freebasic the alternative method is to treat the whole string as in C, using the backslash to "protect" the character that comes right after it, including another backslash, and including low-ASCII codes like the null and newline. This is done by beginning the whole entry with an exclamation point like:

Code: (Select All)
PRINT !"\"D:\\Program Files\\notepad++\\notepad++.exe\" tmp.three"

EDIT: Could also do like Pascal and put two double-quotation marks where one is wanted, but it's strange to read.

https://www.freebasic.net/wiki/ProPgLiterals
(section "String Literals")

EDIT 2: One way to resolve it in QB64(PE) is to write a function called "Quoth$" or alike which replaces a chosen weird character with the CHR$(34). Or wraps the entire string value passed as parameter with CHR$(34). Something like this:

Code: (Select All)
PRINT Quoth$("D:\Program Files\notepad++\notepad++.exe") + " tmp.three"

FUNCTION Quoth$ (astr$)
Quoth$ = CHR$(34) + astr$ + CHR$(34)
END FUNCTION



RE: Chat with Me -- HOST - SpriggsySpriggs - 12-15-2022

I'm so confused. How does Notepad++ play a role in the chat program?


RE: Chat with Me -- HOST - mnrvovrfc - 12-15-2022

(12-15-2022, 02:39 PM)Spriggsy Wrote: I'm so confused. How does Notepad++ play a role in the chat program?

You're right. A new topic should have been started about it.

Early in this topic somebody recalled about launching an external program with "SHELL", questions arose and we're only answering them. Not on topic, but that's what we've been doing.


RE: Chat with Me -- HOST - SpriggsySpriggs - 12-15-2022

Oh, ok. I was trying to follow what was going on and I got lost. I thought maybe we were saving chat logs to Notepad or something.