I've read that ZIP files start with the following bytes:
50 4B 03 04
Reference: http://www.garykessler.net/library/file_sigs.html
Question: Is there a certain sequence of bytes that indicate a ZIP file has been password-protected?
...
Hi
I am doing a simple client implementation of TFTP.
Here i need to send read request in following format
/* send request
2 bytes string 1 byte string 1 byte
------------------------------------------------------
RRQ/ | 01/02 | Filename | 0 | Mode | 0 |
WRQ -----------------------------------------...
I have a sequence of bytes that I have to search for in a set of Binary files using Java.
Example: I'm searching for the byte sequence DEADBEEF (in hex) in a Binary file.
How would I go about doing this in Java? Is there a built-in method, like String.contains() for Binary files?
...
Is it possible in PHP to get a count of the number of bytes transmitted to the client? For example, if I'm outputting a 10 MB file, is there a way to find out if all 10 MB were sent to the client, or to see if the client interrupted the transfer partway? I know Apache will log this afterwards, but I'd like to access the data in PHP.
...
I'm using the Zemanta API, which accepts up to 8 KB of text per call. I'm extracting the text to send to Zemanta from Web pages using JavaScript, so I'm looking for a function that will truncate my text at exactly 8 KB.
Zemanta should do this truncation on its own (i.e., if you send it a larger string), but I need to shuttle this text a...
I've got a python webserver where small binary files are POST:ed. The posted data is represented as strings. I want to examine the contents of these strings. But to do that, I need to convert each 4 bytes to floats (little endian). How do you do that?
...
I was recently asked to take over a project in which waveform data is sampled from a power converter and sent to an intelligent agent where calculations are done and the appropriate actions are taken based on the results.
The following (java)snippet is what the previous coder used to convert the byte array into an array of doubles:
...
I have a byte array of some binary data that i need to send over the network using WCF and NetTcpBinding. My problem is that i need to send only the part of the array. Is there any way to do this, other than copying that part to a separate array, and sending that one. This extra copying degrades performance, and i would like to avoid it,...
I have a Java socket connection that is receiving data intermittently. The number of bytes of data received with each burst varies. The data may or may not be terminated by a well-known character (such as CR or LF). The length of each burst of data is variable.
I'm attempting to build a string out of each burst of data. What is the fast...
I recently brushed up against Firefox's 4096 byte (4KB) limit for individual XML nodes when using Paul Schreiber's unescapeHtml string method to insert a large string of escaped HTML into a CKEditor instance. This approach did not handle a string over 4KB in size in Firefox 3.5.3 due to the browser splitting the content into multiple no...
I'm using VS2005 with "using Unicode Character Set" option
typedef unsigned char BYTE;
typedef unsigned long DWORD;
BYTE m_bGeraet[0xFF];
DWORD m_dwAdresse[0xFF];
How do i make the code work?
MessageBox (m_bGeraet[0], _T("Display Content"));
MessageBox (m_dwAdresse[0], _T("Display Content"));
...
I have a database column that contains the contents of a file. I'm converting this into a byte[] on the server (I don't want to save the file to the disk) and then want to send this to the client to download. The file can be any thing (pdfs, pics, word, excel, etc).
I have the file name so I know the extension but I'm not sure how the ...
I am given a byte[] array in Java which contains the bytes for an image, and I need to output it into an image. How would I go about doing this?
Much thanks
...
I have code like this to convert hex into byte string
(define (word->bin s)
(let ((n (string->number s)))
(bytes (bitwise-and (arithmetic-shift n -24) #xFF)
(bitwise-and (arithmetic-shift n -16) #xFF)
(bitwise-and (arithmetic-shift n -8) #xFF)
(bitwise-and n #xFF))))
(word->bin "#x10000002")
I'm thinking of a similar...
i am actually tryin to convert a csharp code to c... below is the C# code..
CString data = "world is beautiful";
Byte[] quote = ASCIIEncoding.UTF8.GetBytes(data);
in the above code... it converts the string into bytes..similarily is ther a way that i can convert it using C..
Can any body tell what wud be the quivalent code in C?
P...
So I'm trying to invoke a function I have in my unmanaged C++ dll.
void foo(char* in_file, char * out_file)
In my C# application I declare the same function as
[DllImport("dll.dll")]
public static extern void foo(byte[] in_file, byte[] out_file);
The actual parameters I pass through an ASCII encoder like so
byte[] param1 = Encodi...
I have Byte *, want to convert it to std::string. Can you please tell me the safest way to do this?
...
I'm trying to write strictly binary data to files (no encoding). The problem is, when I hex dump the files, I'm noticing rather weird behavior. Using either one of the below methods to construct a file results in the same behavior. I even used the System::Text::Encoding::Default to test as well for the streams.
StreamWriter^ binWriter =...
Hello,
I'm trying to simply convert a byte received from fget into binary.
I know the value of the first byte was 49 based on printing the value. I now need to convert this into its binary value.
unsigned char byte = 49;// Read from file
unsigned char mask = 1; // Bit mask
unsigned char bits[8];
// Extract the bits
for (int i = 0; ...
I have a big binary file with lots of files stored inside it. I'm trying to copy the data of a PCX image from the file and write it to a new file which I can then open in an image editor.
After obtaining the specs for the header of a PCX file I think that I've located the image in the big binary file. My problem is that I cannot figure ...