binary

Send binary to the serial port

To send a serial string character to the serial port. I would need to call WriteFile(handle, "A", strlen("A"), ...) However, what if I want to specify and send a hex or binary number? For example, I want to send WriteFile(handle, 0x41, sizeOf(0x41), ...) ? Is there a function that allow me to do this? ...

How can I implement a stack?

How can I create a program to convert binary to decimal using a stack in C#? ...

How to Check if File is ASCII or Binary in C++

So using the system command file we can use file to determine if a file is ASCII Text or "data". I wanted to know if there is a way to check in code which one it was? I want to basically throw a corrupt error if the file is 'data'. I am using ifstream for reading the files. Thanks for any help! Duplicate of this question. ...

reading FAT12 image file in C

I have a FAT12 image file and I have to open it and read it. I would like to view this image file(directories/files with in) so I can have an idea of what outcomes I should be getting. Anyone know of a good software that would let me view this FAT12 image file? Also can someone guide towards the right directions when trying to read the c...

What are important points when designing a (binary) file format?

When designing a file format for recording binary data, what attributes would you think the format should have? So far, I've come up with the following important points: have some "magic bytes" at the beginning, to be able to recognize the files (in my specific case, this should also help to distinguish the files from "legacy" files) h...

floating point hex octal binary

Hi, I am working on a calculator that allows you to perform calculations past the decimal point in octal, hexadecimal, binary, and of course decimal. I am having trouble though finding a way to convert floating point decimal numbers to floating point hexadecimal, octal, binary and vice versa. The plan is to do all the math in decimal a...

Include binary file with GNU ld linker script

I have a working linker script. I want to add another data section whose contents is pulled directly from a file (ld shouldn't parse it and extract the sections and so on). How can I do that? OUTPUT_FORMAT("elf32-i386") ENTRY(start) SECTIONS { .text 0x100000 : { *(.multiboot) *(.text) *(.code) *(.rodata*) } .data :...

is there a way to read binary data into javascript?

I would like to inject binary data into an object in javascript. is there a way to do this? i.e. var binObj = new BinaryObject('101010100101011'); something to that effect. any help would be great ...

Are there tools to compile CIL to a binary?

After seeing a previous post "Making Applications programmed in .NET languages work on older machines", I've got to wonder; Are there tools to compile CIL to a binary? If so, you could convert a CIL file to a native Windows app if you didn't want the user to require the .NET framework? Or even target the linux platform from .NET! Tha...

Searching for my source code in a binary-only product

Let say I have a project that I have released under GPL, with the sources available to anyone. Later I find a very similar product, but as closed source, distributed binary-only by someone else. Is there a good way to find out they are using my source code in their product? If the solution is to somehow reverse-engineer the binary, is ...

Adding negative and positive binary?

Hi, I have f.eks X = 01001001 and Y = 10101010 If I want to add them together how do I do that? They are "Two's Complement"... I have tried a lots of things but I am not quite sure I am getting the right answer since there seems to be different type of rules. Just want to make sure it is correct: 1. Add them as they are do not convert...

How can I convert a REG_BINARY value from the registry into a string ? (vb.net)

I have a registry value which is stored as a binary value (REG_BINARY) holding information about a filepath. The value is read out into an byte array. But how can I transform it into a readable string? I have read about system.text.encoding.ASCII.GetString(value) but this does not work. As far as I got to know the registry value is arbi...

C# BinaryWrite over SSL

I am trying to respond back to a client with a PDF stored in a MSSQL varbinary(MAX) field. The response works on my localhost and a test server over http connection, but does not work on the production server over https connection. I am using just a simple BinaryWrite (code below). byte[] displayFile = DatabaseFiles.getPdfById(id); ...

how to read NASA .hgt binary files

I'm sure this is really simple if you know anything about binary files, but I'm a newbie on that score. How would I extract the data from NASA .hgt files? Here is a description from www2.jpl.nasa.gov/srtm/faq.html: The SRTM data files have names like "N34W119.hgt". What do the letters and numbers refer to, and what is ".hgt" for...

Saving Program Data

I'm looking for some information and a little history. I am writing a program and I want to save some data without using a database. I'm assuming I could use XML but what else can I use? How do you save data to files and then retrieve them without XML and without plain text? What is Binary formatting, can that be used? Isn't binary forma...

Improper Text data when export as Binary - Textmode.

I am generating a file which contain the following data like this. 78,45,New things,200, Number of columns,2.00,5 When i open the file in textpad with the textformat binary type. 0: FF FE 33 00 36 00 2C 80 00 20 30 10 4F 7.8.4.5,4.5, In the data part it has (.) between two successive digits. ...

Saving a Base64 string to disk as a binary using PHP

As a "look under the covers" tutorial for myself I am building a PHP script to gather emails from a POP3 mailbox. While attempting to make use of binary attachments I am stuck trying to figure out what to do with the attachment information. Given a string that would be gathered from an email: ------=_Part_16735_17392833.12296539921...

Why HTTP protocol is designed in plain text way?

Yesterday, I have a discussion with my colleagues about HTTP. It is asked why HTTP is designed in plain text way. Surely, it can be designed in binary way just like TCP protocol, using flags to represents different kinds of method(POST, GET) and variables (HTTP headers). So, why HTTP is designed in such way? Is there any technical or his...

Binary SMS in Symbian

I wonder if anyone has managed to create a working code for sending out binary messages (to configure Symbian phones) and have also some binary data sample. So far all the samples I have found fail to leave the Outbox or never return. // Current entry is the Draft folder. iSmsMtm->SwitchCurrentEntryL( KMsvDraftEntryId ); // Crea...

Whats the actual file size?

(Only programmers would know) In Windows XP, under File Properties, Whats the actual file size?.. Size or Size-on-disk? I'm looking for the exact size of the file, in bytes.. (1,024 bytes NOT 1,000 bytes) Great! So blame it on the disk!, Why not call it Size Windows takes to store this file? ...