Click here to Skip to main content
15,890,043 members
Everything / Bytes

Bytes

bytes

Great Reads

by Bernhard Nebel
How does asynchronous serial communication work, what Arduino libraries are there to support it, and what can go wrong?
by Coral Kashri
In this article you will see how to save bytes and alignment when containing some types inside a structure.
by ToughDev
Experiment with ST7920 128×64 graphical LCD on PIC
by dynamichael
Use extension methods, Encoding, and BitConverter to read and write native types on an IO.Stream object

Latest Articles

by ToughDev
Experiment with ST7920 128×64 graphical LCD on PIC
by Coral Kashri
In this article you will see how to save bytes and alignment when containing some types inside a structure.
by Bernhard Nebel
How does asynchronous serial communication work, what Arduino libraries are there to support it, and what can go wrong?
by dynamichael
Use extension methods, Encoding, and BitConverter to read and write native types on an IO.Stream object

All Articles

Sort by Score

Bytes 

21 Jan 2022 by Bernhard Nebel
How does asynchronous serial communication work, what Arduino libraries are there to support it, and what can go wrong?
29 Apr 2016 by Richard Deeming
The command works fine for me from the Windows 10 "Run" dialog. However, if you're trying to call it via Process.Start, you'll need to expand the environment variables first:Process.Start("rundll32.exe", Environment.ExpandEnvironmentVariables("appwiz.cpl,NewLinkHere...
29 Apr 2016 by Dave Kreskowiak
The correct command line is: rundll32.exe appwiz.cpl,NewLinkHere %USERPROFILE%\DesktopYou're typing: rundll32.exe appwiz.cpl,newlinkhere %USERPROFILE%\Desktopwhich will NOT work as the function name is case sensitive!
16 May 2017 by Jochen Arndt
You have to know the type of data being passed. Without that information you can't do anything useful. If you know that the data represents some kind of file type you can try to detect the type. With Linux there is the file command that uses the magic(5): file command's magic pattern file -...
9 Jun 2015 by OriginalGriff
Don't do it like that!Do not concatenate strings to build a SQL command. It leaves you wide open to accidental or deliberate SQL Injection attack which can destroy your entire database. Use Parametrized queries instead.Surprisingly, that'll also cure your problem...When you concatenate...
9 Jun 2015 by Richard Deeming
Your code is vulnerable to SQL Injection[^].NEVER use string concatenation to build a SQL query. ALWAYS use a parameterized query.A side-effect of fixing this serious security vulnerability in your code will be that you will also fix your problem:public string InsertUpload(string...
10 Jan 2016 by ridoy
If your bytes array contains only characters then you can go with FileWriter. If it isn't then OutputStream is the way to go.OutputStream out = new FileOutputStream("out.pdf");out.write(bArray);out.close();
19 Jan 2016 by F. Xaver
like Sergey and Tomas mentioned in the Comments there is nothing wrongdec / hex / bin121 = 79 = 0111 1001 26 = 1A = 0001 1010the value in the array is already what you want.It's only displayed in decimal where you wanted (or better thought it should be) hexif you wont to...
19 Jan 2016 by CPallini
Decimal and hexadecimal are two different representations of a number.HexBytes[3] = 11; //(1) this is fineHexBytes[3] = b; //(2) such a statement is not validHexBytes[3] = 0xb; //(3) this is fine and completely equivalent to (1)Please note that (1) and (3) are translated to exactly the...
15 Apr 2016 by Richard Deeming
Translating the undocumented VB function to C# is pretty simple:[DllImport("shell32", EntryPoint = "#60")]private static extern int SHShutDownDialog(long p);c# - Shut Down Dialog From A Thread - Stack Overflow[^]Whether it's a good idea to rely on an undocumented function which...
30 Apr 2016 by Dave Kreskowiak
I already told you what your only real option is.Google for "locky.exe" and you'll find all kinds of information on it, but you're never going to get it removed.WIPE THE DRIVE AND REINSTALL WINDOWS FROM MEDIA. THIS IS YOUR ONLY OPTION.Just stopping the service will not work. It WILL...
1 May 2016 by Garth J Lancaster
I would use PendMoves PendMoves and MoveFile[^] and set the file for a delete on reboot
16 May 2017 by OriginalGriff
If you have tried methods from a different site, the most sensible thing to do would be to ask a question of the person who wrote the code, not a different site completely. The second most sensible thing would be to show the code you tried - as you tried it - by copy'n'pasting it into your...
6 Jun 2018 by Jochen Arndt
There is no existing method as already noted in solution 1. But it is quite simple to declare an array of ushort with the same number of items as in the byte array and copy the data within a loop: ushort[] arr16 = new ushort[arr8.Length]; for (int i = 0; i
29 Jun 2022 by CPallini
In your code, the WriteFile call sets the value of NumberOfBytesWritten. Afterwards, NumberOfBytesWritten maintains its value, unless you explicitely change it (or call again WriteFile). The CloseHandle (as you may easily infer from its...
9 Mar 2015 by phil.o
If you start from the hexadecimal representation of the value, and you want to work with it, you have to do it in several steps:- First, translate this hexadecimal string representation of a byte array into a byte array- Second, pass this byte array to the GetString() method of the...
8 Mar 2015 by Praneet Nadkar
Hi,Depending on which encoding was used, use the following code:byte[] binaryString = (byte[])reader[1];// if the original encoding was ASCIIstring ascii = Encoding.ASCII.GetString(binaryString);// if the original encoding was UTF-8string utf =...
31 Mar 2015 by deepankarbhatnagar
Helping links for your query: http://forums.asp.net/t/1369026.aspx[^]http://stackoverflow.com/questions/28576279/asp-net-chunked-html5-video-streaming[^]
8 Jun 2015 by OriginalGriff
Start by checking in the debugger: as CPallini says, it's likely that your richTextBox1 is not a valid control - which presumably means you created it in your code instead of allocating it via the designer. So it won't be displayed either!Look at the designer, highlight the rich text box you...
25 Jan 2016 by OriginalGriff
Start by using the debugger.Create a file which contains 4 bytes with hex values 00 FF 55 AARun your app, and look at the resulting file. It should be00000000111111110101010110101010And nothing else.Now use that file as the input to your ConvStep2 method, and put a break point on the...
1 May 2016 by Jochen Arndt
A locked file can't be deleted. You must close the file in the application that has it opened (or close that application).To determine which application has opened a spefic file you can use the Process Explorer[^].In the "Find" menu select "Find handle or DLL" and enter the file name...
1 May 2016 by Sergey Alexandrovich Kryukov
In addition to Process Explorer, you can use simpler utility, Sysinternals Hanlde. Please see my past answer:how to compress the error 'it is already used by another process' in vb.net[^].Sysinternals Suite is a must-have for any developer.However, it's good for your personal use,...
20 Sep 2016 by OriginalGriff
Serial ports are generally not "fast devices" - and when you use 9600 baud, you are saying "this port transfers 9600 bits of information per second at most". That's roughly 960 bytes per second (slightly less than that due to start, stop, and parity bits in fact) - which in terms of your PC...
21 Oct 2016 by OriginalGriff
That's complicated in C#, because casting doubles to "byte friendly" values in C# isn't possible in "normal" code.If you have a look at the Reference Sources however, you can see how they do it - and it's pretty simple:[System.Security.SecuritySafeCritical] // auto-generatedpublic unsafe...
16 Jun 2017 by Dave Kreskowiak
Ummm...it seems you have no idea how .ZIP files work. Either that or you're doing a terrible job of describing the problem. The original path is not saved in the .ZIP. If you add folders to a .ZIP the RELATIVE path is saved. That means the files are unzipped to a path relative to where the...
9 Aug 2018 by OriginalGriff
Whooo! Nope. It's not just the language, it's the environment in which the language will be run. For example, I've seen C compilers that generate code using a 16 bit int, a 32 bit int, and if I recall correctly I've seen a 128 bit integer as well! Modern languages - or at least frameworks -...
31 Oct 2018 by CPallini
As suggested, use the (generic-text variant of) strtol: void StrToByte2(LPCTSTR str, BYTE * dest) { LONG u16 = _tcstol( str, NULL, 16); dest[0] = (BYTE) (u16 >> 8); dest[1] = (BYTE) (u16); } or at least, write a sensible hand-crafted one. Try void StrToByte2Alt(LPCTSTR str, BYTE dest[])...
4 Mar 2019 by Richard MacCutchan
See Secure Password Authentication Explained Simply[^].
4 Mar 2019 by OriginalGriff
What makes you think that a password is encrypted? It shouldn't be: that's insecure, nearly as bad as storing it in plain text. And System.Text.Encoding has nothing whatsoever to do with encryption - it's a translation, is all. Passwords should be hashed, not encrypted - specifically so thay...
28 Nov 2019 by Gerry Schmitz
windows - How to get a directories file size from an FTP protocol in a .NET application - Stack Overflow[^]
23 Mar 2020 by phil.o
Here you can find an example implementation for C: c - How to turn a hex string into an unsigned char array? - Stack Overflow[^]
25 May 2020 by OriginalGriff
See here: Creating a ReadOnlySequence from Array Data - Steve Gordon[^]
24 Feb 2021 by OriginalGriff
Start by finding out exactly what you are receiving: instead of using GetString to convert the bytes, convert them to a hex string (BitConverter.ToString Method (System) | Microsoft Docs[^] will do it) and add that to your text box. You can then...
24 Feb 2021 by Dave Kreskowiak
There's no such thing as a "global" variable in C#, or .NET really. You're not going to "detect" anything happening to a variable. However, you can store what you consider "global" data in Properties in a static class. The property get/set code...
26 Feb 2021 by BillWoodruff
imho: using a bunch of bytes to store information that requires parsing to interpret is, generally, a bad idea. While you can simulate "global" variables in C# using static Fields, or static Properties, or certain Types declared as Const...
25 Feb 2021 by Patrice T
Quote: How would I go about it, and what would be the most time efficient way to do it? Assuming the byte array is fixed length fields, butchering a byte array is so basic operations that it is difficult to see a difference of efficiency between...
27 Feb 2021 by User 15025775
It looks you did not create the buffers for arrInt1 (and all the others). At least for me a.) this one fails with the error message you mentioned: Byte[] arrInt1= null; Byte[] bytesFromTCP = new Byte[530]; MemoryStream memStream = new...
14 Jun 2021 by Richard Deeming
You forgot to tell us what the problem is. Fortunately, it's pretty obvious: a website cannot access files on the user's device. You are asking a page hosted on drive.google.com to display a file stored in your local application data folder....
9 Mar 2015 by Divakar Raj M
I have an web application which reads varbinary from SQL as a byte array in code. Basically it does a ExecuteScalar of the column and returns it as a byte array.I am now doing a mini version of the application as a Windows application. For this, I am trying to skip the DB connection. I am...
10 Mar 2015 by Divakar Raj M
I got it using this piece of code string hex = richTextBox1.Text int NumberChars = hex.Length; byte[] bytes = new byte[NumberChars / 2]; for (int i = 0; i
31 Mar 2015 by kubibay
How could we implement to read mp4 video data as chunked byte arrays which is shown below is sends all byte buffer at the same time?$(document).ready(function () { $('#btnUploadLocal').on('click', function () { var files = $("#file1").get(0).files; var reader =...
2 Apr 2015 by kubibay
I can do it now using slice command; var chunk = file.slice(offset, offset + chunkSize);
5 Apr 2015 by tslin89
Hello, I am now working on the project that need to send data to show on LED display through TCP/IP. The supplier have no SDK for this LED so I am now trying to send data through TcpClient .net library.Command format to display data on LED provided by my supplier is as follow:format = ...
5 Apr 2015 by OriginalGriff
One way to do it is to create it as a single string, with embedded hex values:string format = "\x0001Z00\x0002AA\x0006104500\x0001MyData\x0004";byte[] data = Encoding.ASCII.GetBytes(format);That will generate the 22 byte array you want:015A Z30 030 00241 A41 A0631 130 034 435 530...
5 Apr 2015 by phil.o
Do you understand the string 0x01 + "Z" + "00" + 0x02 + "AA" + 0x06 + "10" + "4500" + 0x01 + "MyData"+ 0x04?I mean, does "00" really mean two 0 characters, instead of 0x00? Same for "AA": are they really two A characters, or are they rather 0xAA?You may have to study and understand the...
15 Apr 2015 by kubibay
Hi,I'm planning to save an online mp4 link to user's local using embedded server. I can do it from input file control. But now I have to do it for online mp4 video.What I do for file is to send byte array with parts using file.slice method using ajaxrequest as formdata. Then embedded server...
17 Apr 2015 by kubibay
I have implemented mp4handler for nancyfx and it worked.
18 Apr 2015 by Sergey Alexandrovich Kryukov
You can store images in the form of files on the host implementing the service. Those files should have unique file names; and the database can store only the file names. This is a pretty usual approach.—SA
11 May 2015 by sreedharmaruthi
Hi, I have structure :struct StartReadXML { public int CmdID;//3 public char[] CmdName;//ReadXML public char[] Description; };With initializations as below :StartReadXML startXML=new StartReadXML(); startXML.CmdID = 3; ...
13 May 2015 by kubibay
Embedded server and http://chimera.labs.oreilly.com/books/1230000000545/ch15.html#DOWNLOADING_DATA_WITH_XHR[^]is the solution
18 May 2015 by sudeshna from bangkok
HelloI have created a project where I have crystal reports also. I enter images from front end side and it gets stored in database in binary data.This is done otherwise my images werent getting displayed in gridview or crystal report.So all the images are of file type.When i...
18 May 2015 by Afzaal Ahmad Zeeshan
Your local environment is not the same as your hosting environment. On your local environment you can easily add or remove features or functions. On your hosting environment you are bound to their rules and policy terms. You have to abide them in order to use their system to host your...
27 May 2015 by CPallini
Your MemoryStream instance contains no data (see the documentation[^]).
27 May 2015 by OriginalGriff
Since you are writing into the memory stream, and get the error there implies that the error is actually a fair way away from this point. Have a look at where you load the Image - if the original stream you loaded the image from is not still open, then you will get this error - it's in the...
7 Jul 2015 by Sergey Alexandrovich Kryukov
You will need to use content-type "text/html" for the whole e-mail or some of its parts in case of multi-part e-mail. CSS can be embedded exactly as in stand-along HTML.Embedding an image is more tricky. You need to create a multi-part e-mail. Let's say, one part is the image, which has...
10 Sep 2015 by Matt T Heffron
First of all, it isn't clear exactly what you are trying to do.In a comment, you said that this is in the handler that is taking the chunks that the client sends and is trying to assemble them into a bigger byte array, eventually containing the whole file sent by the client.With that...
23 Nov 2015 by Savad.k.s
Is there any way to convert byte[] to string in c# directly
23 Nov 2015 by Suvendu Shekhar Giri
Try this-string myString = System.Text.Encoding.UTF8.GetString(myByteArray);Hope, it helps :)
23 Nov 2015 by Savad.k.s
my c# program get hang when it run . Can any one please tell me whyprivate void button1_Click(object sender, EventArgs e) { sck = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); IPEndPoint localEndPoint = new...
23 Nov 2015 by CPallini
It hangs because receive is a blocking call: if there is no data to receive then it waits. This is the reason why it is usually invoked in a separate thread.[update]Have a look at "Asynchronous Client Socket Example" at MSDN[^].[/update]
23 Nov 2015 by PANKAJMAURYA
You have to set the TimeOut properties for the socket connection because if you don't set a timeout the sockect keep waiting until data arrives and hangs your program execution.The possible solution is using Async method.Asynchronous Client Socket Connection[^]GitHub Demo Project using...
25 Jan 2016 by Feverbird
Hey there my beloved Community,i'm currently trying to convert any file into a textfile consisting of it's own bits and bytes (e.g. any exe file to a string of 100010010010010010101...) and then reconverting them to a working file.the conversion to a string seems to work, but somehow i...
23 Apr 2016 by Chris Losinger
this doesn't work? [^]var img = new Image();img.src = 'image.jpg';var context = document.getElementById('canvas').getContext('2d');context.drawImage(img, 0, 0);data = context.getImageData(x, y, 1, 1).data;
25 Apr 2016 by Mahesh_Bhosale
Please refer following link :How to convert image to byte array using javascript ? - Stack Overflow[^]
11 Jul 2016 by User 6976447
I wrote the following methods, public static byte[] BitmapToByteArray(Bitmap image) { byte[] returns = null; if (image.PixelFormat == PixelFormat.Format8bppIndexed) { BitmapData bitmapData =...
17 Aug 2016 by MCSIDevelopers
What I want to do is not get the information about the file but I want to read the bits and also be able to locate bits positions within the frame header. The header is 32 bits (4 bytes) of which is what I want to get back or displayed as a message.I want to read it, edit it. The bit i want...
17 Aug 2016 by Paw Jershauge
You can use FileStream for that FileStream.ReadByte Method (System.IO)[^]
19 Sep 2016 by H.AL
I have asked this question before but I got no answer. I am trying to get blob data from oracle and read it, than converting my Byte Array to base 64 so I can display later my image in my web page. But the problem is that my blobs are so huge, each array byte length is more than 1 500 000, so...
19 Sep 2016 by OriginalGriff
It works for me:Dim rawData As Byte() = File.ReadAllBytes("D:\Test Data\BigImage.jpg")Dim base64 As String = Convert.ToBase64String(rawData)Console.WriteLine("{0}:{1}", rawData.Length, base64.Length)Gives me:3489676:4652904Which is an input image data file twice the size of the ones...
20 Sep 2016 by Member 12292743
Dim outData As Byte() = New Byte(0) {}Private Function HextoByte(ByVal msg As String) As Byte() msg = msg.Replace(" ", "") Dim combuffer As Byte() = New Byte(msg.Length \ 2 - 1) {} For i As Integer = 0 To msg.Length - 1 Step 2 combuffer(i \ 2) =...
20 Sep 2016 by Ralf Meier
If you want to read more than 1 Byte (this answer is additional to the solution from OG) then you could/should wait until "SerialPort1.BytesToRead" has that value you want to have - perhaps with a loop or "Do ... until" ... or in the method "serialPort1_DataReceived" you check first if...
20 Sep 2016 by CPallini
You might use a buffer to append received bytes (one at time) to. Then when the accumulated bytes in the buffer are enough, you process them in order to abtain the meaningful info.
10 Oct 2016 by NathanRO
Take a look at this open source QR code library. You should be able to utilize it to encode the "chunks" into individual QR codes and export them as images.Open Source QRCode Library
21 Oct 2016 by partha143
Hello,I need to convert float number to byte[] apart from using inbuilt method BitConverter.GetBytes. I want to achieve this by using some logic.Thank you.What I have tried:I googled, but was unable to find anything apart from the builtin method BitConverter.GetBytes.
10 Nov 2016 by Member 1898210
Hi all,I'm having issues with achieving something I'm sure you guys can assist.I'm trying to iterate over a Wave file and process 20ms of the audio data each time. However, I'm getting confused with the bytes arrays and conversions and I'd be grateful if someone can assist on this with...
9 Nov 2016 by Richard MacCutchan
You are using Buffer.BlockCopy to copy from data to sampleBuffer, and then from shortBuffer to InpBuf. But you never put any data into shortBuffer. Your code is quite confusing with all those different buffers. All you really need is one in which to read the data. You can then process specific...
10 Nov 2016 by Bernhard Hiller
I think Buffer.BlockCopy copies bytes, not shorts. Since you use 16bit samples, you have to copy twice as much bytes.
10 Apr 2017 by OriginalGriff
Your string is not a valid Base64 string: it's length is wrong at 37 bytes, and I don't believe in the least that a minimal Winforms app will come in at under 7.5K of binary, so I'd be looking for a Base64 string of around 10K. At a guess, you copy and pasted it badly - check your code that...
20 Apr 2017 by caf20012
Hi, I'm having a problem inserting a byte image into my datagridview; Firstly Form Class: Dim imgbyte As Byte() = Nothing Form Load: table.Columns.Add("Image", GetType(Byte())) Button to generate data to datagridview; table.Rows.Add(GetType(Byte) Button2 to add image to...
20 Apr 2017 by ongilito
Imports System.IO Imports System.Drawing.Imaging Imports System.Drawing Public Class Form1 Dim ms As MemoryStream Dim imgData() As Byte Dim sqlSTR As String 'This code saves the image in form of byte into SQl Server Sub saveImage() Dim p As New SqlParameter ...
18 Jun 2017 by RickZeeland
I don't know about DotNetZip, but 7zip can do it, you can call it with Process.Start(). Examples from 7zip help: 7z a archive1.zip subdir\ adds all files and subfolders from folder subdir to archive archive1.zip. The filenames in archive will contain subdir\ prefix.7z a archive2.zip .\subdir\*...
22 Nov 2017 by CPallini
If you need to store the CString object for later retrieval I sugggest you using Serialization in MFC | Microsoft Docs[^]. That said, in your code you are calling str.ReleaseBuffer() despite you didn't call str.GetBuffer() and, in any case you could have written instead CString str = "I am...
6 Jun 2018 by hamid18
i have a byte array.. Each index is having values like 0x01, 0x1D etc.. It can be seen that these values are 8 bit numbers. I want to convert them to 16 bit numbers. for example, I want this type of result 0x0001 0x001D. Is there some way to do this in C#? What I have tried: BitConverter...
6 Jun 2018 by Richard MacCutchan
The BitConverter Class (System)[^] does not appear to have a method to do this for you. You will need to write your own.
14 Jul 2018 by Gerry Schmitz
I'm pretty sure you are being treated as a "virus" by the OS (creating garbage exe's).
14 Jul 2018 by OriginalGriff
Don't read it as text: read it directly as bytes: byte[] data = File.ReadAllBytes(pathToFile); File.WriteAllBytes(pathToExe, data); Data in ASCII can be just 7 bit, and different systems will interpret some of it in different ways (like \n and \r being "condensed" when you read them for...
14 Jul 2018 by Patrice T
Quote: i am using C# exe and i am trying to turn it in to a string that i can use on other programs i make. the file is called bit.exe. they not much info then that If I understand, you want to embed a random exe in your program and probably silently run it as being yours. Even if legal and...
9 Aug 2018 by CHill60
Google is your friend... Integer (computer science) - Wikipedia[^]
9 Aug 2018 by Patrice T
Quote: Is the size of int is same for all languages or it varies with the language you use? Size of int have evolved with time. In the 80"s int was 8 bits because' processors were 8 bits. then it was 16 bits and now it is usually 32 bits. lets guess in future it will be 64 bits. if you get a C...
27 Sep 2018 by LRazvan96
Hello, I want to convert a data type in a byte address. + And i have to escape that "0x" from my data. And the data type will be as string(i think) but it may be int or whatever. I don't know what to write in code. Thanks! For example: What I have tried: public void blabla(string...
27 Sep 2018 by OriginalGriff
That's possibly more complicated that you think: a string is an array of characters (or it can be thought of, and treated as such) but a char in .NET is not equivalent to a byte, it is a Unicode value and is thus a 16 bit value, unlike byte which is an 8 bit value. There are ways to convert it,...
19 Nov 2018 by Member 11117644
Good day, I have a 16 byte string which I encode to bytes and then immediately convert it to a readable Hex string. The result is that it added 00 after every single Hex and I cannot seem to understand why. My String: var message1 = "Thats my Kung Fu"; Conversion: var stringToByte =...
18 Nov 2018 by F-ES Sitecore
c# - Why Encoding.Unicode.GetBytes() returns an additional 0 - Stack Overflow[^]
19 Nov 2018 by phil.o
var stringToByte = Encoding.UTF8.GetBytes(message1); orvar stringToByte = Encoding.ASCII.GetBytes(message1); would both give you the result you are expecting.
19 Nov 2018 by Dave Kreskowiak
You used the Unicode encoding to get the bytes. It's not behaving lie you expect probably because you have no idea what Unicode is. I suggest reading up it here: What is Unicode?[^].
17 Jan 2020 by 49R
How raw data is divided into bytes. As present audio contains 32bit(2^32 tones) it ranges from 2^0 - 2^32. ex -> 6710497.. (Considering decimal) how is it divided to 67 104 97 Does FileInputStream has a method to check like if(671>256){send 67 , next append 1} What I have tried: ...
17 Jan 2020 by Richard MacCutchan
Any file, or data, is just a stream of bits. In general it is convenient to handle the stream as a collection 8-bit bytes. However the bytes are often grouped together to make different types of information (int, double, string etc.). The key is that you need to know the structure of the data in...
17 Jan 2020 by Patrice T
Quote: How java bytestream works? In a stream, a byte is the smallest chunk of data you can handle because it is how computer works. You can consider that a byte is like a digit (for computer), just like for us, a digit is 0-9 for us. A bytestream have no idea of the meaning of bytes or their...
16 May 2020 by Jacxx
I have a List/array with some integers. array = {1,2,3,4,5,7,11,14,15...} for each integer that exists in the array/list from 1 to 8 i append a bit until 1 byte and then convert the binary to decimal. In this case 11111010(6 and 8 does not...
14 May 2020 by Richard MacCutchan
Something like the following will capture eight bits at a time: int pattern = 0; for ( // expression to iterate over your list { if ( // if the value exists { pattern |= 1; } pattern