Chat Boss
ㅤManjeet Saini sent a code, it has been re-uploaded as a file
itsmanjeet
ㅤManjeet Saini sent a code, it has been re-uploaded as a file
I need help in reading unicode file in c, here is the code
\Device\NUL
itsmanjeet
Why not read the file until EOF ?
Actually i tried fread previously, that's why using size, then tried with fgetwc and fgetws
itsmanjeet
Invalid bytes in buffer
\Device\NUL
Invalid bytes in buffer
Is it UTF32 or UTF16 ?
itsmanjeet
uh, where to specify that? I am reading a normal text file to read,
itsmanjeet
I am not very much aware about unicode format,
\Device\NUL
I am not very much aware about unicode format,
That's depend on what sizeof(wchar_t) return
itsmanjeet
UTF 32
harmony5 🇺🇳 ⌤
uh, where to specify that? I am reading a normal text file to read,
Every text file has an encoding. There are multiple encodings that can encode all unicode code points. Some examples are utf-8 (the most common encoding), utf-16, utf-32, and many more.
harmony5 🇺🇳 ⌤
uh, where to specify that? I am reading a normal text file to read,
They are basically different ways to read and parse the bits of the file
itsmanjeet
Means the bytes size for one character?
harmony5 🇺🇳 ⌤
Ok, for the text file, my text editor showing the utf-8 format
You specify the encoding in the program reading the file, not the file itself* *there are ways to hint the program about which encoding is used, but still it's the program that decides how to read the file
harmony5 🇺🇳 ⌤
Means the bytes size for one character?
Sometimes it means that, but don't take it for granted and search for the specific encoding you're dealing with. In the case of utf8 it is a variable length encoding, meaning characters have different byte sizes (there are characters that use only 1 byte, but others may use 2, 3, 4, up to 6 bytes)
harmony5 🇺🇳 ⌤
So issue is with the byte size that i am providing, which is sizeof(wchar_t) == 4?
Sorry replying so late, but what is the exact error you're getting?
harmony5 🇺🇳 ⌤
So issue is with the byte size that i am providing, which is sizeof(wchar_t) == 4?
Maybe check here: https://stackoverflow.com/questions/21737906/how-to-read-write-utf8-text-files-in-c
Ahsanul Seddiqi
Hello
Nascar
hello guys
Maxim
hello guys
https://nohello.net/
Thakur
Hiii
Thakur
I need c course pdf
Shady
I need c course pdf
See pinned message
Divyam
Help me on how to become a full stack C/C++ developer
harmony5 🇺🇳 ⌤
Help me on how to become a full stack C/C++ developer
#include <string.h> int main() { int stacksize = 100; void* stack[stacksize]; memset(stack, 1, sizeof(stack)); return 0; }
harmony5 🇺🇳 ⌤
What about now?
\Device\NUL
What about now?
You should use sizeof(stack)
harmony5 🇺🇳 ⌤
AmR
What is equivalent in normal c++ for QByteArray ?
harmony5 🇺🇳 ⌤
So issue is with the byte size that i am providing, which is sizeof(wchar_t) == 4?
I think yes. I think it may be when you use fgetwc to read the file
Dima
Dima
stupid bot lol, we should make rules more relaxed
Dima
i can resend your message because it looks like a really nice question
Billy ᛭
A quick brown fox jumped over the lazy dog.
数学の恋人
Dude just resorted to that sentence.
Never Spam Bot
Fox is now approved by the group admin and can send messages without any restrictions Thank you, this bot is genuinely annoying. See spam? Quote the spam message in the group and reply with /spam
Billy ᛭
Yay
Dima
send a link with spaces to avoid getting your message deleted by another bot lmao
Dima
its so silly jeez we need to discuss it with admins
Billy ᛭
Thanks. So again, hi there fellow C/C++ developers. You guys are generally the smartest out of all developers out there so I hope for your help. I've recently read Clean architecture by Robert Martin (a great book and it is worth attention because the author is obviously very smart and experienced, and everyone who bashes his book does not know what they are talking about). In the book, we have this: NOT ALL COMPONENTS SHOULD BE STABLE If all the components in a system were maximally stable, the system would be unchangeable. This is not a desirable situation. Indeed, we want to design our component structure so that some components are unstable and some are stable. The diagram in Figure 14.8 shows an ideal configuration for a system with three components. The changeable components are on top and depend on the stable component at the bottom. Putting the unstable components at the top of the diagram is a useful convention because any arrow that points up is violating the SDP (and, as we shall see later, the ADP). The diagram in Figure 14.9 shows how the SDP can be violated. Flexible is a component that we have designed to be easy to change. We want Flexible to be unstable. However, some developer, working in the component named Stable, has hung a dependency on Flexible. This violates the SDP because the I metric for Stable is much smaller than the I metric for Flexible. As a result, Flexible will no longer be easy to change. A change to Flexible will force us to deal with Stable and all its dependents. To fix this problem, we somehow have to break the dependence of Stable on Flexible. Why does this dependency exist? Let’s assume that there is a class C within Flexible that another class U within Stable needs to use (Figure 14.10). We can fix this by employing the DIP. We create an interface class called US and put it in a component named UServer. We make sure that this interface declares all the methods that U needs to use. We then make C implement this interface as shown in Figure 14.11. This breaks the dependency of Stable on Flexible, and forces both components to depend on UServer. UServer is very stable (I = 0), and Flexible retains its necessary instability (I = 1). All the dependencies now flow in the direction of decreasing I. Abstract Components You may find it strange that we would create a component—in this example, UService—that contains nothing but an interface. Such a component contains no executable code! It turns out, however, that this is a very common, and necessary, tactic when using statically typed languages like Java and C#. These abstract components are very stable and, therefore, are ideal targets for less stable components to depend on. When using dynamically typed languages like Ruby and Python, these abstract components don’t exist at all, nor do the dependencies that would have targeted them. Dependency structures in these languages are much simpler because dependency inversion does not require either the declaration or the inheritance of interfaces. Illustrations are as follows: i . imgur . com / GgWawn3 . png i . imgur . com / MVPqSrr . png
Billy ᛭
So my question is: 1. How, and why, is this strategy is necessary in statically typed languages? Is it something enforced by the language itself, or is it just a software architecture principle which only applies to static languages (like the interface segregation principle, which Martin demonstrates to reflect problems of static languages but not dynamic ones)? I've asked my C++ senior dev buddy if it is something enforced by the language and he said that he needs some time to think about it. He has not yet found a single example where a language would enforce the necessity to use an interface.
Billy ᛭
2. How would it differ in the dynamically typed languages like Python and Ruby? Please draw the diagram of dependencies in a dynamic language like these ones that Martin drew for static ones so I would understand it better.
Billy ᛭
3. How great is this question compared to the questions generally asked here?
Billy ᛭
Thanks.
Billy ᛭
I've been confused about it since the way the book was translated in Russian says that "it is the only possible way" in static languages, not "necessary". But Martin's use of the word "necessary" is only a bit less confusing here.
Billy ᛭
And yes, I admit that it is confusing because I could not understand it. I'm really sorry for being stupid.
Danya🔥
Thanks. So again, hi there fellow C/C++ developers. You guys are generally the smartest out of all developers out there so I hope for your help. I've recently read Clean architecture by Robert Martin (a great book and it is worth attention because the author is obviously very smart and experienced, and everyone who bashes his book does not know what they are talking about). In the book, we have this: NOT ALL COMPONENTS SHOULD BE STABLE If all the components in a system were maximally stable, the system would be unchangeable. This is not a desirable situation. Indeed, we want to design our component structure so that some components are unstable and some are stable. The diagram in Figure 14.8 shows an ideal configuration for a system with three components. The changeable components are on top and depend on the stable component at the bottom. Putting the unstable components at the top of the diagram is a useful convention because any arrow that points up is violating the SDP (and, as we shall see later, the ADP). The diagram in Figure 14.9 shows how the SDP can be violated. Flexible is a component that we have designed to be easy to change. We want Flexible to be unstable. However, some developer, working in the component named Stable, has hung a dependency on Flexible. This violates the SDP because the I metric for Stable is much smaller than the I metric for Flexible. As a result, Flexible will no longer be easy to change. A change to Flexible will force us to deal with Stable and all its dependents. To fix this problem, we somehow have to break the dependence of Stable on Flexible. Why does this dependency exist? Let’s assume that there is a class C within Flexible that another class U within Stable needs to use (Figure 14.10). We can fix this by employing the DIP. We create an interface class called US and put it in a component named UServer. We make sure that this interface declares all the methods that U needs to use. We then make C implement this interface as shown in Figure 14.11. This breaks the dependency of Stable on Flexible, and forces both components to depend on UServer. UServer is very stable (I = 0), and Flexible retains its necessary instability (I = 1). All the dependencies now flow in the direction of decreasing I. Abstract Components You may find it strange that we would create a component—in this example, UService—that contains nothing but an interface. Such a component contains no executable code! It turns out, however, that this is a very common, and necessary, tactic when using statically typed languages like Java and C#. These abstract components are very stable and, therefore, are ideal targets for less stable components to depend on. When using dynamically typed languages like Ruby and Python, these abstract components don’t exist at all, nor do the dependencies that would have targeted them. Dependency structures in these languages are much simpler because dependency inversion does not require either the declaration or the inheritance of interfaces. Illustrations are as follows: i . imgur . com / GgWawn3 . png i . imgur . com / MVPqSrr . png
I'd not be so generous with words in this chat
Billy ᛭
I'd not be so generous with words in this chat
I'd rather ask a C dev when I don't know something than a PHP dev because C has higher entry threshold and filters out less talented developers. Even I was not able to learn C.
Dima
Thus a C dev is more narrow-minded
can you stfu for one second please when it gets to C-related talk?
Billy ᛭
I'd rather ask a C dev when I don't know something than a PHP dev because C has higher entry threshold and filters out less talented developers. Even I was not able to learn C.
I am also not going to do it in foreseeable future because there are simply no entry-level C positions so far, and imitating a middle C developer for a newbie like me would be difficult.
Billy ᛭
What is hard about C? It's really one of the easiest and one of the stupidest languages out there
scary pointers and my programs just won't compile. i'm dumb. rip
Danya🔥
Dima
Can you just admit that you're stupid?
why would I admit, I can come out as stupid
Billy ᛭
I don't think anybody is going to read all of this and really understand. So, I'd advise to rephrase it on your words
I may sound rude but If someone is not going to read something technical written by Robert Martin - okay, if someone has not read his Clean Architecture yet - they are instantly not qualified to answer this question. (Just like people who can't understand that they better watch TV shows not in the order of their to-watch list but in the order of what looks most promising to them to avoid wasting their time on bad shows, their IQ is too low to understand my favorite arthouse anime, and in this case, they should not really be watching it because it is not made for them.)
Dima
Cum out please
you are currently the one keeping off-topic in this main group
Dima
thats against the rules
Billy ᛭
Reading Martin's book is not making you "qualified"
I know about it. I asked this exact question because I know that I am not smart enough to figure it out on my own and I doubt if my answer to this question is ever correct. If you don't have anything to say then please just shut up. I am not going to "make it as pleasing to answer as possible", everything needed to answer my question is in the question himself. I highly doubt that I would be able to accurately rephrase Robert Martin because he is Robert Martin, and I am a mere mortal aspiring web developer.
Billy ᛭
Thanks. So again, hi there fellow C/C++ developers. You guys are generally the smartest out of all developers out there so I hope for your help. I've recently read Clean architecture by Robert Martin (a great book and it is worth attention because the author is obviously very smart and experienced, and everyone who bashes his book does not know what they are talking about). In the book, we have this: NOT ALL COMPONENTS SHOULD BE STABLE If all the components in a system were maximally stable, the system would be unchangeable. This is not a desirable situation. Indeed, we want to design our component structure so that some components are unstable and some are stable. The diagram in Figure 14.8 shows an ideal configuration for a system with three components. The changeable components are on top and depend on the stable component at the bottom. Putting the unstable components at the top of the diagram is a useful convention because any arrow that points up is violating the SDP (and, as we shall see later, the ADP). The diagram in Figure 14.9 shows how the SDP can be violated. Flexible is a component that we have designed to be easy to change. We want Flexible to be unstable. However, some developer, working in the component named Stable, has hung a dependency on Flexible. This violates the SDP because the I metric for Stable is much smaller than the I metric for Flexible. As a result, Flexible will no longer be easy to change. A change to Flexible will force us to deal with Stable and all its dependents. To fix this problem, we somehow have to break the dependence of Stable on Flexible. Why does this dependency exist? Let’s assume that there is a class C within Flexible that another class U within Stable needs to use (Figure 14.10). We can fix this by employing the DIP. We create an interface class called US and put it in a component named UServer. We make sure that this interface declares all the methods that U needs to use. We then make C implement this interface as shown in Figure 14.11. This breaks the dependency of Stable on Flexible, and forces both components to depend on UServer. UServer is very stable (I = 0), and Flexible retains its necessary instability (I = 1). All the dependencies now flow in the direction of decreasing I. Abstract Components You may find it strange that we would create a component—in this example, UService—that contains nothing but an interface. Such a component contains no executable code! It turns out, however, that this is a very common, and necessary, tactic when using statically typed languages like Java and C#. These abstract components are very stable and, therefore, are ideal targets for less stable components to depend on. When using dynamically typed languages like Ruby and Python, these abstract components don’t exist at all, nor do the dependencies that would have targeted them. Dependency structures in these languages are much simpler because dependency inversion does not require either the declaration or the inheritance of interfaces. Illustrations are as follows: i . imgur . com / GgWawn3 . png i . imgur . com / MVPqSrr . png
Once again, here's a smart question for which I could not figure out a solution on my own:
harmony5 🇺🇳 ⌤
Thanks. So again, hi there fellow C/C++ developers. You guys are generally the smartest out of all developers out there so I hope for your help. I've recently read Clean architecture by Robert Martin (a great book and it is worth attention because the author is obviously very smart and experienced, and everyone who bashes his book does not know what they are talking about). In the book, we have this: NOT ALL COMPONENTS SHOULD BE STABLE If all the components in a system were maximally stable, the system would be unchangeable. This is not a desirable situation. Indeed, we want to design our component structure so that some components are unstable and some are stable. The diagram in Figure 14.8 shows an ideal configuration for a system with three components. The changeable components are on top and depend on the stable component at the bottom. Putting the unstable components at the top of the diagram is a useful convention because any arrow that points up is violating the SDP (and, as we shall see later, the ADP). The diagram in Figure 14.9 shows how the SDP can be violated. Flexible is a component that we have designed to be easy to change. We want Flexible to be unstable. However, some developer, working in the component named Stable, has hung a dependency on Flexible. This violates the SDP because the I metric for Stable is much smaller than the I metric for Flexible. As a result, Flexible will no longer be easy to change. A change to Flexible will force us to deal with Stable and all its dependents. To fix this problem, we somehow have to break the dependence of Stable on Flexible. Why does this dependency exist? Let’s assume that there is a class C within Flexible that another class U within Stable needs to use (Figure 14.10). We can fix this by employing the DIP. We create an interface class called US and put it in a component named UServer. We make sure that this interface declares all the methods that U needs to use. We then make C implement this interface as shown in Figure 14.11. This breaks the dependency of Stable on Flexible, and forces both components to depend on UServer. UServer is very stable (I = 0), and Flexible retains its necessary instability (I = 1). All the dependencies now flow in the direction of decreasing I. Abstract Components You may find it strange that we would create a component—in this example, UService—that contains nothing but an interface. Such a component contains no executable code! It turns out, however, that this is a very common, and necessary, tactic when using statically typed languages like Java and C#. These abstract components are very stable and, therefore, are ideal targets for less stable components to depend on. When using dynamically typed languages like Ruby and Python, these abstract components don’t exist at all, nor do the dependencies that would have targeted them. Dependency structures in these languages are much simpler because dependency inversion does not require either the declaration or the inheritance of interfaces. Illustrations are as follows: i . imgur . com / GgWawn3 . png i . imgur . com / MVPqSrr . png
Not answering your question, but now that you mention bob martin: https://www.reddit.com/r/programming/s/CPSkfqNTQs
Billy ᛭
Not answering your question, but now that you mention bob martin: https://www.reddit.com/r/programming/s/CPSkfqNTQs
Is this a post that says that Martin's opinions are subjective, his books should not be followed as cargo cult and he is an old man yelling at things?
Billy ᛭
Oh nevermind