14,801 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
Advice
0
votes
3
replies
78
views
How to write binary bytes to file, NOT ASCII
I am working on a program to convert CNG files to JPEG and cannot figure out how to write the binary bytes to a file. My test code is:
import struct
import os
barray = bytearray()
s = '...
0
votes
1
answer
140
views
Finding an Integer value in A binary file in C [closed]
In C, I first opened a binary file like this---
FILE *BINfile = fopen("./tmp.bin", "rb+");
Then I transferred the data into an unsigned char array (typedef as byte) like this---
(...
Advice
2
votes
5
replies
148
views
How to use space as an delimiter when the entire string is made up of spaces?
I've written a program that takes in a text then prints the binary translation of it. İts been working perfectly fine until I tried the case where entire string is just made up of spaces. As to ...
Advice
0
votes
4
replies
45
views
GNU ld binary output format
I have the following c source:
int _start(){}
which I compile as:
gcc -c -o main.o main.c -ffreestanding
then I link as:
ld -oformat binary main.o
The binary's hexdump looks as:
$ hexdump a.out
...
Best practices
0
votes
4
replies
142
views
Best way to extract a VBA Date out of a byte array and turn it back into a valid VBA Date?
I have confirmed that the following VBA code works just fine.
Dim mydate As Date
mydate = Date
Open "C:\Windows\Temp\dlctest.data" For Binary Access Write As #1
Put #1, , mydate
Close #1
...
4
votes
3
answers
195
views
How to do a simple swap of two half of a 32bit integer in c?
I am trying to figure out a code that would be able to swap the higher half and the lower half of the binary form of an integer number such as for example:
0000000 00110011 01001001 11111110 turn into ...
2
votes
3
answers
150
views
different behaviour of objcopy with binary output between Windows and Linux
I have created a simple hello.c which contains just the definition of an array:
unsigned char arr[4] = {1,2,3,77};
I have then compiled it with gcc -r in order to produce a relocatable object file. ...
0
votes
2
answers
162
views
How can I store Huffman-encoded bits into a truly compressed binary file in Java?
I'm building a Huffman compressor in Java.
I already have: The original text, the Huffman code table (Map<Character, String>), and the order of character appearance.
My current goal is to write ...
0
votes
0
answers
94
views
Is my interpretation of working with Hamming SEC code correct?
The problem: "Use Hamming's code to detect if there was an error in the following message and correct it."
m_8
m_7
m_6
m_5
m_4
m_3
m_2
m_1
c_4
c_3
c_2
c_1
1
1
1
0
1
0
1
1
0
0
0
1
My first ...
0
votes
2
answers
193
views
C program for changing binary to signed integer doesn't work properly
I have a C program that I made that is supposed to convert binary into a signed integer, but it does not give the correct result.
Here is the function of the code that converts binary numbers to ...
0
votes
1
answer
137
views
Why does my binary input 10 come out as 8? [duplicate]
I coded int num1_bin = 00000010;
However, in the debug console, it comes out as 8. Is there a mistake in my code, or a setting in C++?
I just started coding in C++ for univ.
I expected int num1_bin = ...
-1
votes
3
answers
100
views
Python Bit Shifting [closed]
Assume I have a 1 source variable (int) which is 10 bits long. Let's call it src.
I have 2 destination variables (int) which are 8 bits long namely byte1 and byte2.
MSB LSB
src ...
0
votes
2
answers
142
views
How can i convert a negative binary number to sbyte(c#)
I am messing around with c#, and i noticed something. If i were to instantiate an sbyte
with 8 bits, such as 0b_1111_1111 (-1), it throws an error, but if i were to first make a byte with it, and then ...
3
votes
1
answer
168
views
How to convert binary to utf-8 and vice-versa in R?
I want to code a shinyApp which can convert a string from binary (0 and 1, not hex) to utf-8 and vice-versa.
Example :
encode("Aé") # return "010000011100001110101001"
decode("...
2
votes
1
answer
185
views
How to Extract Individiual Frames From an .ani File?
I'm writing a Winforms app that will allow me to change my cursor. My goal is to have buttons with each having their own respective cursor as their image by converting their files into bitmaps. ...