I'm reading in a binary file (a jpg in this case), and need to find some values in that file. For those interested, the binary file is a jpg and I'm attempting to pick out its dimensions by looking for the binary structure as detailed here.
I need to find FFC0 in the binary data, skip ahead some number of bytes, and then read 4 bytes (...
So here's my issue. I have a binary file that I want to edit. I can use a hex editor to edit it of course, but I need to make a program to edit this particular file. Say that I know a certain hex I want to edit, I know it's address etc. Let's say that it's a 16-bit binary, and the address is 00000000, it's on row 04 and it has a value of...
How do I use WriteByte? The below code will not work, coming up with both a CS1502 error, and a CS1502 error at the "stream.WriteByte(totalSeasons);" line. It's frustrating because I am incredibly close to finishing this program.
Essentially, my problem is that I need to write binary data to a file on the click of a button. I can just w...
Let's say I have two integers with the following binary representations:
01101010
00110101
And now I want to copy the last 3 bits from the first integer over the second one so that it becomes
00110010
What's the easiest way to do that?
(Actually, my goal is to shift the all the X+1 bits to the right one, essentially deleting the X...
I wrote program to convert decimal to binary for practice purposes but i get some strange output. When doing modulo with decimal number, i get correct value but what goes in array is forward slash? I am using char array for being able to just use output with cout <<.
// web binary converter: http://mistupid.com/computers/binaryconv.htm
...
I have some binary data which has a corresponding "map" file which identifies each data point in the binary data by providing a bit offset and length. So, I might have the following mappings:
$paths = array ( "path1" => array ("offset" => 224, "size" => 2),
"path2" => array ("offset" => 226, "size" => 6),
);
In actua...
What I'm trying to do is, make the class message serialize and deserialize it's self. Not into or from a file, but into or from a binary sequence as a string or cstring.
Message.h:
class Message
{
private:
int message_id;
int sender_id;
std::string sender_data;
Message ();
public:
Message (int id, std::string da...
I am faced with the following problem. I need to (de)serialize (binary) a stream of objects to a single file on disk. Serialization part is not an issue, just open a stream in append mode and use .Net's BinaryFormatter Serialize method and you are done. The problem with this approach is that I can't just give this stream to BinaryFormatt...
I have a hex value in a string like
h = '00112233aabbccddee'
I know I can convert this to binary with:
h = bin(int(h, 16))[2:]
However, this loses the leading 0's. Is there anyway to do this conversion without losing the 0's? Or is the best way to do this just to count the number of leading 0's before the conversion then add it in...
Hi ,
in visual basic i can open a binary(exe) file with below way :
Strx$ = Space(FileLen(FileName))
Open FileName For Binary As #1
Get #1, , Strx$
Close
in this way i can read all of binary file characters and read file content like this format :
and the question is how can i open a binary(exe) file in delphi with a string format...
Can anyone tell me why I get the following output on x64 architecture:
$ php -r 'echo pow(2, 33) . "\n";print_r(unpack("Ivalue", pack("I", pow(2, 33))));'
8589934592
Array
(
[value] => 0
)
It seems as though it can handle signed 64bit ints, but can't pack / unpack them. According to the docs: http://us3.php.net/pack, the size of ...
int x = 5;
cout<<(char)x;
the code above outputs an int x in raw binary, but only 1 byte. what I need it to do is output the x as 4-bytes in binary, because in my code, x can be anywhere between 0 and 2^32-1, since
cout<<(int)x;
doesn't do the trick, how would I do it?
...
I've got a char* buffer to hold a file that i read in binary mode. I know the length of the file is 70 bytes and this is the value being used to produce a buffer of the correct size. The problem is, there is 17 or 18 extra spaces in the array so some random characters are being added to the end. Could the be a unicode issue?
ulFLen stor...
I'm trying to write a simple TGA image file saver as a learning exercise in C++. I'm basing my code on an example TGA loader that declares a struct for the header and then uses fread() to load the entire header in one go.
My program isn't working right now, and it seems like there are two extra bytes being written to the file. I printed...
what i mean is that if i want to store for example 11110011 i want to store it in exactly 1 byte in memory not in array of chars.
example:
if i write 10001111 as an input while scanf is used it only get the first 1 and store it in the variable while what i want is to get the whole value into the variable of type char just to consume onl...
I would like to be able to take a stream of 1's and 0's and convert it to a format that jpg can read, I.E. suppose I wrote a program and compiled and got an exe, then took and ran the 1's and 0's from the exe through said program, it would produce a .jpg. Any tips on what I need to do? I am hoping it's not as difficult as I'm suspecting ...
Hi,
Can some one provide me with a list of leading binary research tools for Windows OS and windows applications? I found BinScope from microsoft itself but was wondering if there are any other better tools around?
Thanks,
Omer
...
I trying to write a simple Python script that inserts .odt documents into an SQLite database. Here what I have so far, but it doesn't seem to work:
f=open('Loremipsum.odt', 'rb')
k=f.read()
f.close()
cursor.execute="INSERT INTO notes (note) VALUES ('%s')" %(sqlite.Binary(k))
cursor.close()
conn.close()
I don't get any error messages, ...
I was following these tutorials to make a simple kernel that I would then load using GRUB. The instructions for compiling didn't work (ld couldn't find the -T option) and when I finally got a compiled file it was in Macho format. What are the correct steps to take when compiling these files on Mac.
Edit:
I compiled the code on an Ubuntu ...
I pre-generate 20+ million gzipped html pages, store them on disk, and serve them with a web server. Now I need this data to be accessible by multiple web servers. Rsync-ing the files takes too long. NFS seems like it may take too long.
I considered using a key/value store like Redis, but Redis only stores strings as values, and I susp...