C++ Standards, Extensions, and Interop
How do I edit nibbles in my program?
And how would I write the nibbles to a file, how would I be able to make the total of them divisable by two so that whole bytes get writen?
Of course you cannot do that directly, but...you can use masking and shifting. You cannot write a nibble, you need to write bytes. You are looking from the wrong angle with the last question. N bytes = 2N nibbles. That is always true. If you have a value that is less than 16, the other nibble is zero, right? unsigned char theByte = 0xaf; unsigned char theLittleNibble = theByte & 0x0f; unsigned char theBigNibble = theByte >> 4 & 0x0f; unsigned char theNewByte = theBigNibble << 4 | theLittleNibble;
You need to write them 4 at a time (so you write a full byte). In the case when you have a remainder, you may need to read the existing byte from the file, modify the bits you care about, then write the byte back out.Microsoft Test - http://tester.poleyland.com/
You should also clarify if it is a UK nibble or a US nibble. They are different number of bits. http://en.wiktionary.org/wiki/nibbleMicrosoft Test - http://tester.poleyland.com/
Thanks for the help U.S. nibble
Josh Poley [MSFT] wrote: > >You should also clarify if it is a UK nibble or a US nibble. They are different number of bits. > >http://en.wiktionary.org/wiki/nibble I would argue that Wiktionary is wrong. I've been computing for a very long time, and I have never in my life heard "nibble" or "nybble" used to refer to anything other than 4 bits. -- Tim Roberts, timr#probo.com Providenza & Boekelheide, Inc. Tim Roberts, DDK MVP
Beginner c++ question--Bitwise enumerations
int i = 2; Is this the Assingment Operator here ?
How do you define a template class's constructor outside the class
MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain#16 referenced in function ___tmainCRTStartup
How to use another variable from another Form in VisualC++
Accessing a member through a pointer
How to copy one char* array into another one?
definition of dllimport static data member not allowed
mspdbsrv.exe consuming over 1.4GB
Visual c++, how to find a file in certain folder and print its name?
abstract classes in cpp
Convert float to String
LNK1104 error - DEBUG vs. RELEASE
recvfrom on a udp socket does not receive in release build/mode
Error C2039, error c2065 with compiler setting at /clr