I am currently trying to compress/decompress a list of 64-bit integers using LZ4 algorithm.
In the repository, it says that LZ4_decompress_safe_partial() can be used to decompress an LZ4 compressed block of desired output bytes, starting at desired position.
Specifically, what I want to do is to only decompress particular portions of the compressed data, and retrieve only those portions of the given source.
For instance, in the example of simple_buffer.c, const char* const src is given as "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor site amat.".
After compressing it into char* compressed_data, I only want to retrieve, say, consectetur adipiscing elit as the output of the decompression, by only partially decompressing compressed_data.
It says that the first argument of LZ4_decompress_safe_partial() indicates where to start the decompression. How do I determine the starting position of the compressed_data which relates to c of consectetur? Is there any meta-data or other way to figure this out?
Thanks in advance.
Related
I have C code which contains references to requirement numbers of a very simple pattern:
/**
* Lorem ipsum, you know the routine.
* See also: Requirement R12345.
*/
In other words, the requirement is an R followed by exactly 5 decimal digits. I would like to add those to my ctags file so I can jump to tags with :ta R12345. I've read the exctags docs up and down, but could not find any option that would allow this.
I thought of grepping for the requirements and patching up the tags file with appropriate lines (using search for line numbers probably makes this easy) but I am not sure if the extra lines would need to be merged or just appended, and what the exact format is.
I must be blind not recognizing the --regex-<LANG> option. This does exactly what I want:
ctags ... --regex-c='/\<(R[[:digit:]]{5})\>/\1/' *.[ch]
This creates the tags file with additional tags for all R12345 requirements.
Ok so I am currently trying to make an avi from a set of bitmaps.So I popped open a sample avi file in a hex editor to check things out. It starts out right with "RIFF". The next four bytes represent the file size: which i got "40 6A EA 00" in HEX. Now this translates to 1080748544 in decimal and some 128 MB. But the file is actaully just 15 MB. What gives?
Digvijay
Haha ok, I got the answer. Basically the file size was given in little endian format, and hence i was calculating the wrong size. "40 6A EA 00" does translate to 128 MB. However "00 EA 6A 40"(Where EA is the most significant byte) does actually come out to about 15 MB
Digvijay
I would like to know about the meaning of each byte in a wav / mp3 files.
But find nth from google...anyone knows where i can find such information?
(Infact I would like to know all types of multimedia files in the bitstream level)
MP3 files are divided into frames, each begins with a sequence of FRAMESYNC bits so hardware can find the beginning of each frame. More here.
Some info about WAV is here.
i'm using this portion of code
char encrypted_text[1024];
RSA_public_encrypt(sizeof(message), message, encrypted_text, rsa, RSA_PKCS1_OAEP_PADDING);
printf("encrypted text: %s\n", encrypted_text);
and the optput is something like this:
�v0��뷾��s�E�Z��N\����6~��:�&���� /����~ͯ���L��d�Ǡ��
E��[�h�U.vH2F1Qb^)�g� ,a�Ҩ�x vU|�>�ˢ=W�ő��
�\��g
it's possible to eliminate � symbols??
The string isn't printing well because it's binary data, not text. It's not meant to be human readable.
A common way to make binary data text-friendly is to base64 encode it. Base64 encoding converts binary data into a string of ASCII characters. The encoded text still isn't human readable, so it'll still look like gobbledygook when you print it, but it'll at least be easy on the eyes, easy to paste into text files, easy to e-mail around.
See this Stack Overflow question for ways to do base64 encoding/decoding in C.
I have for example this line in my file (note that the numbers after = are every time different):
abcd=1234
and I need to change it to:
abcd=9999
How can I do it?
Try sed -i.backup -e 's/abcd=.*/abcd=9999/' filename.txt
Example in filename.txt
abcd=123
abcd=15652
Output as expected:
abcd=9999
abcd=9999
Note: It has been presented to me that this is the GNU sed, which has some extensions apparently that make it different from the normal sed. I was not aware of this, and I have no means to verify this. If someone has the non-gnu solution, please feel free to edit it in.