Chat with Me -- HOST
#41
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
If eggs are brain food, Biden takes his scrambled.
Reply
#42
(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.
Reply
#43
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
Reply
#44
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
Reply
#45
Aye.  I know what he tried to do.  I just wanted him to see what he actually did.  Wink
Reply
#46
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.
Reply
#47
(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
Reply
#48
I'm so confused. How does Notepad++ play a role in the chat program?
Ask me about Windows API and maybe some Linux stuff
Reply
#49
(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.
Reply
#50
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.
Ask me about Windows API and maybe some Linux stuff
Reply




Users browsing this thread: 33 Guest(s)