I am used to C and Embedded system. For a general C++ developer, myString is a C++ String or C-string. I want to write some code that can be used for learning C++ and I want to make sure I create the correct mind set for a beginner C++ programmer, so he/she can blend better in the future.
I am used to C and Embedded system. For a general C++ developer, myString is a C++ String or C-string. I want to write some code that can be used for learning C++ and I want to make sure I create the correct mind set for a beginner C++ programmer, so he/she can blend better in the future.
Because tons of stuff such as i++ has a return value and having to add a keyword to it to stop it from printing is super annoying. Adding a thing to make it print is much more reasonable.
I know it says 0 if int and 1 if anything else but isnt that implying if int is passed into the function thats true since the definition of printf and main both return an int
class drkk
{
public:
static int buffering(HANDLE * file, std::vector<BYTE> _data, int point, int pos, int quant);
};
int drkk::buffering(HANDLE * file, std::vector<BYTE> _data, int point, int pos, int quant)
{
// my code here for the function ...
}
does this make sence?
do i need to initialize de parameters in my class?
Those are the names of the parameters. You can leave them out in the declaration if you want, but usually it makes sense to leave them in. int point, int pos, int quant carries a lot more information than int,int,int.
Adding const is not a problem because not modifying something you are allowed to modify is ok. Removing const is a problem because modifying something you are not allowed to modify is bad.
@jeyejow Because you are using non-standard extensions.
To clarify the previous comment on you being confused: Your teacher probably babbled something about blocks and that reading and writing in whole blocks is faster. That is nothing you need to worry about. Every read and write function knows that and you can just write the whole vector at once, let the implementation do its job and probably gain performance.
yes but i want to basicly read x bytes for a file in my computer and then send the info trhu a socket to another computer
thats why i made it 512 bytes
because there is a size to the packets
well im getting an error
i tried what you guys sed about removid the HANDLE * file and just use HANDE file and now i use the file (HANDLE) in a function and it gives mwe error in the function
im using SetFilePointer
gives me error 6
ERROR_INVALID_HANDLE 6 (0x6) The handle is invalid.
why does it give me that error?
the function is waiting a Handle and i pass it a Handle, when i use in the parameters Handle * it works but if i use Handle if says its invalid handle
basicliy im usign ReadFile function and one of the parameters is the place to store the information that was read and i put the vector in that parameter
The short answer is "because C++ has moved on". Yes, back in the late 70's, Stroustrup intended to create an upgraded C with OOP capabilities, but that is a long time ago. By the time the language was standardized in 1998, it was no longer an OOP language. It was a multi-paradigm language. It cer...
I'm unsure what is your goal: - if you have written code and you want to check it out if it does what it's supposed to, compile it (and at this point it can fail with a compile error), and run it (and at this point it can crash or do a different thing than you expect it to do) - if you have written code and it does what it's supposed to, but you aren't sure whether it could have been written better, then you're asking for a code review
or are you stuck on some part and you aren't sure how to continue?
My approach to programming is to write thing in parts: write a single function, compile it, possibly write some other function which calls it with a sample data to see if it runs correctly, then when I'm confident whether it works correctly, get to another one
Well, it was mostly a matter of reaffirmation that what I've coded is valid code. I'm new to coding and was hoping for a second pair of eyes to take a look at what I've written. I'm most nervous about a few lines reading "pixels[i].get_red(static_cast<uint8_t>(R));" and similar.
Though, your point that I should try and finish the code before asking for advice is good advice.