Pack timestamp in 4 bytes [closed] - c++

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I am very restricted in memory usage.
I need to store a datetime in my program. Precision is one second. Only 4 bytes for one datetime value.
What is the best way to achieve this?

Pick the earliest date/time you need to represent and mark that your epoch. Then use a four byte unsigned type as seconds-since-epoch. Be aware this will only give you a ~68 year range but that's all you can get with your restrictions.

Related

How to convert a large binary number to decimal? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I am facing a problem. The maximum binary number I am able to convert is 1000000000000000000. Is there any way to convert a binary number larger than this?
There is a function called strtoull (string to unsigned long long integer) which should work, follow the link for an example. https://en.cppreference.com/w/cpp/string/byte/strtoul

how to generrate array of integers (exact same every time)? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am trying to generate array of integers within specific limit using random number generator but I want exact same array every time .
Seed your generator with the same seed value every time and it will produce the same sequence of numbers (true for most generators).

Turning a string that contains a equation into an integer [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I would like to be able to convert a string such as "(5+6)*6" and get the resulting integer from that equation. It is important that it starts out as a string.
You can use library fastmathparser for c++.
In link is example how use this library.
If you really want write alone this parser, I recomended use Shunting-yard algorithm

How do programmers add huge values such as those seen in RC5/RC6 encryption [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
So as part of RC6 encryption, the key size can be up to 256 bytes and operations are performed on the key throughout the encryption process. How do programmers store such huge values and perform operations on them? Specifically in C++?

different between CRC8 , CRC16 and CRC32? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I would like to know the difference and how to choose the polynomial generator for different crc ?
And in some C code they have look up table to compute crc and some of them do it by xor truth table. but in both the cases it is 1byte data array. Its confusing . Could somebody explain this as well ?
Thanks.!