« first day (152 days earlier)      last day (2925 days later) » 

00:03
Wait wait it makes sense right now,
"267) The three predefined streams stdin, stdout, and stderr are unoriented at program startup."
"After a stream is associated with an external file, but before any operations are performed on it, the stream is without orientation."

So because we haven't do fscanf(stdin, "%d", 5); or something operation like that the stream is unoriented, am I right?
yes, until you do a reading or writing operation, the stream is unoriented
> Once a wide character input/output function has been applied to a stream without orientation, the stream becomes a wide-oriented stream. Similarly, once a byte input/output function has been applied to a stream without orientation, the stream becomes a byte-oriented stream.
00:15
"A stream is associated with an external file (which may be a physical device) by opening a file,"
"At program startup, three text streams are predefined and need not be opened explicitly"

Here is my summary,
The text streams stdin, stdout, and stderr are implicitly opened.
Thus, because those are opened, those are immediately associated with an external file (which may be a physical device)
After that, the stream is initially unoriented because we haven't done any operation on it.
Beautiful..
And now I understand why footnotes are not constituting any requirement.
Because the requirement are already defined elsewhere in the standard BODY

Why must you need to define the same thing twice? It is inefficient.. lol

Am I right?
00:33
@Unknown123 I'd think so
@Unknown123 I'd say they are for people like you, so you don't have to search for multiple standard requirements
hahahaha thank you very much for your compliment
Bravooo, so now I understand the concept of stream, footnotes, and also the standard stream
The wide character input functions — those functions described in 7.29 that perform input into wide characters and wide strings: fgetwc, fgetws, getwc, getwchar, fwscanf, wscanf, vfwscanf, and vwscanf.

The wide character output functions — those functions described in 7.29 that perform output from wide characters and wide strings: fputwc, fputws, putwc, putwchar, fwprintf, wprintf, vfwprintf, and vwprintf.

The wide character input/output functions — the union of the ungetwc function, the wide character input functions, and the wide character output functions.
@milleniumbug Why fwrite and fread are not avaliable in a wide oriented stream? What is the main reason?

Does that mean we can't write struct into a file with wchar_t member in it?
01:05
@Unknown123 No, you're deducing stuff that's not stated. Having a byte oriented stream means you can't use wide I/O functions on it. Nothing more, nothing less.
@Unknown123 Standard usually doesn't provide rationale for its decisions (unless maybe in notes sometimes), so you'll have to be satisfied with my guessing:
fread can't be used on a wide character stream because it reads bytes, not characters
02:04
http://ideone.com/UWVjti
Sorry I was learning
Consider this code, http://ideone.com/UWVjti
It works well on input, but not on the output, why is that happened?
 
11 hours later…
13:01
> Byte input/output functions shall not be applied to a wide-oriented stream and wide character input/output functions shall not be applied to a byte-oriented stream.
> If a ‘‘shall’’ or ‘‘shall not’’ requirement that appears outside of a constraint or runtime-constraint is violated, the behavior is undefined.
@Unknown123 also, a sanity tip: Simply don't mix line reading functions with *scanf family
Either use scanf-family functions only, or only line reading functions, which you can parse further with sscanf
@milleniumbug Thank you for your advice, It's just only an example, fgets, buffer set to nul clear newline, clear buffer, then sscanf, golden rule of c input lol haha
Because i'm using wprintf and wscanf as the operation, the orientation of stdin and stdout is wide-oriented

But i'm opening file "wide.dat" with wb+ and my first operation is fwrite, of course the orientation of my fp stream is byte-oriented
13:16
getchar() is a byte input function
okay try again then
I forgot about that
Hi, here anyone know about mongodb?
13:31
Umm, it doesn't work supposedly either,
There is no such fwrite and fread for binary stream, so how could I write a struct to a file with wide char member in it?
13:49
hello, im just getting nervous with that piece of code (6 errors)
in menu.cpp:
#include "stdafx.h"
#include <string>
#include <Windows.h>
#include <iostream>
#include "doc.h"
#include "menu.h"

std::string menu::service::location;
doc::documentation menu::service::documentation;

void menu::service::init()
{
	HMODULE hModule = GetModuleHandleW(NULL);
	WCHAR path[MAX_PATH];
	GetModuleFileNameW(hModule, path, MAX_PATH);

	char ch[260];
	char defined = ' ';
	WideCharToMultiByte(CP_ACP, 0, path, -1, ch, MAX_PATH, &defined, NULL);

	std::string result(ch);
	result = result.substr(0, result.find_last_of('\\'));
and menu.h:
namespace menu
{
	class service
	{
	private:
		static std::string location;
		static doc::documentation documentation;

	public:
		static void init();
	};
}
there are errors as following: missing type specifier - int assumed, 'string is not member of std', location: unknown override specifier etc
don't paraphase the errors
just copy and paste them
e.g like this:
Severity Code Description Project File Line Suppression State
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int Dokumentacja C Line 8
?
anyway, just because menu.h sees the definitions when included inside menu.cpp it doesn't mean it will see them when included in a different file
your header file is not stand-alone - bad, bad, baaaaaaad idea
it also seems to be missing include guards or #pragma once
(by "it's not standalone" I mean that including it relies on the user to include another header beforehand, which is <string>)
it also means the order of the header includes is relevant, which is the worst idea ever
(header files provided by Microsoft often do that - but that's because Microsoft can't write header files well)
On the spot I cant make a head or tail of it
please, give me a minute
or just ten
14:14
so actually I should have included headers from cpp in my .h ? and that would be good one solution?
it seems so because it worked
only the ones you need
here it would be <string> and whatever one which declares doc::documentation
also don't forget include guards
ok, thank you :)
14:34
@milleniumbug ping..
15:06
@Unknown123 Don't have time to check it, but my advice: reduce your test case. You're trying to check whether fread can read the previously fwriten struct, so don't check for unrelated things like reading and writing with wide I/O from/to standard input/output
 
5 hours later…
user1593881
19:39
Do sequential STL containers automatically resize when an element is removed?
they're "resized" as in the size() is changed
(because it's one less now)
(I suspect you're asking a different question, but only you can clarify)
user1593881
I am following this SO question.
user1593881
I thought they did but needed a confirmation. What about std::array?
nope, can't remove elements from std::array
user1593881
Ah I see. Fixed size array wrapper.
19:44
they're looking for an indexed structure they can remove elements from
that's actually a rare thing
user1593881
@milleniumbug Thanks, your help is appreciated.
of course one could wonder whether they actually need these capabilities, because it's not like they ever told us what are they using this structure for

« first day (152 days earlier)      last day (2925 days later) »