Apr 15, 2013 at 7:24pm UTC
Last edited on Apr 15, 2013 at 7:24pm UTC
Apr 15, 2013 at 7:58pm UTC
Er, I meant L'\0'
- the double quotes were supposed to be single quotes.
Apr 15, 2013 at 8:33pm UTC
What if you needed to write both regular and unicode null-terminated strings to the same stream?
I will admit, the uses are rare.
Apr 15, 2013 at 8:37pm UTC
stream << regular_string << '\0' << unicode_string << L'\0' << std::flush;
You can't use std::ends because it can not guess whether the string before it was a regular or unicode string.
Last edited on Apr 15, 2013 at 8:37pm UTC
Apr 15, 2013 at 8:56pm UTC
ah. Yeah okay there it makes sense.
Apr 15, 2013 at 9:16pm UTC
Another useful purpose (in the Windows world) is about GetOpenFileName:
The files filtering functionality uses a NULL character to split Extension and Description. Obviously the entire "string" ends with a double NULL character.
Apr 15, 2013 at 9:20pm UTC
Yes but that's embedding the null in the middle of a string. IE:
"Text files\0*.txt\0All Files\0*\0"
That's different from referring to a single character.
Apr 15, 2013 at 9:31pm UTC
@Disch thank you, thank you for using "*" for All Files and not "*.*"
Apr 15, 2013 at 10:33pm UTC
@Disch: Yeah, Right.
@LB: No risk with us, I'm used to do that too.
Apr 16, 2013 at 7:56pm UTC
IIRC, in the Windows world "*.*" is more correct than "*".
Apr 16, 2013 at 7:58pm UTC
There are plenty of files that come pre-installed on my machine that have no extension.
Apr 16, 2013 at 7:58pm UTC
That doesn't change the behavior of Windows when pattern-matching files.
Apr 16, 2013 at 11:45pm UTC
It does, because it searches for a matching dot in a filename.
Doesn't it?
WHAT THE... IT DOESN'T!
Last edited on Apr 16, 2013 at 11:45pm UTC
Apr 17, 2013 at 12:09am UTC
Wow, I didn't expect that - it treats *.* as a special case and even displays files with no dots in their name.
Apr 17, 2013 at 2:47am UTC
Originally, all filenames had a dot (technically), so you aren't actually pattern-matching the dot. You are pattern matching everything before the dot and everything after the dot.
Google "hysterical raisins". :O)
Apr 17, 2013 at 6:31am UTC
How do I select file with dot and not without one?
http://gm4.in/i/dmj.png
(Legit, can send screenshot of entire folder in explorer)
Last edited on Apr 17, 2013 at 6:32am UTC
Apr 17, 2013 at 7:39pm UTC
I don't believe you.
That one with the dot at the end must have spaces or some other non-glyph character in the extension.