All Questions
Tagged with binary-number or binary
14,795 questions
0 votes
0 answers
51 views
Is there a `to_str_radix` function for Rust? [duplicate]
I'm trying to display a binary number as a string like so: let string = b.to_str_radix(2); But I cannot find a to_str_radix function in std. Searching in the Rust Standard Library gives zero results. ...
-2 votes
0 answers
57 views
Counting Binary Palindromic Numbers
I'm trying to solve the Leet Code question #3677 (Count Binary Palindromic Numbers) in javascript. The algorithm works correctly, but I keep getting a 'Time Limit Exceeded' error when I submit. I've ...
Advice
0 votes
7 replies
123 views
Number of bits used for representing different types vs what the CPU uses
I was thinking about floats and doubles and was wondering if the fact that they use 32 bits and 64 bits respectively means there is a performance increase either in terms of memory used or time for ...
1 vote
1 answer
50 views
How to return binary from AWS Lambda with Function URL
I want to return binary files (e.g. images, PDF) from an AWS Lambda function with a function URL. I am not using API Gateway. The documentation for the return object does not say much about the body, ...
Advice
2 votes
1 replies
72 views
How to convert integer to booleans representing binary digits?
Apologies if this is a dumb question, I'm new to both stack exchange and programming in general. Anyway, here's the problem I'm facing: I'm writing a function for a lua program, and I need to convert ...
Advice
0 votes
7 replies
119 views
Serial communication using binary
I have inherited a DAC that outputs voltages given serial commands (these commands go from the RS-232 port through a serial-to-fiber converter to the device). To get off the ground with it, I have ...
0 votes
1 answer
69 views
Issue porting code from GDScript to Dart to read Flipnote PPM files
I was making an app in Godot that reads Flipnote PPM files thanks to the reverse engineering done on this file format. I'm trying to remake everything in Dart and Flutter due to some Godot limitations,...
Advice
1 vote
6 replies
34 views
Confusion about the naming of binascii.hexlify
Does anyone know what the 'l' in the name of Python's binascii.hexlify is for? Why isn't it "hexify" instead of "hexlify"? Googling it gave me nothing. ChatGPT predictably gave me ...
Advice
0 votes
3 replies
93 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
168 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
154 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
51 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
145 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
207 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
194 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. ...