by
84k 18
0
5
1,159
0
Top 1% !
Popular
Famous
Tagged
Specified
Popularity: 30076th place

Published on:

Architecturex86_64
LanguageC#
Windows VersionWindows7

Read stream until space is found (space, new line, tab or comment). Returns number of bytes read. Stream's position will point to the next

Read stream until space is found (space, new line, tab or comment). Returns number of bytes read. Stream's position will point to the next
byte coming after the first found space byte.
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/1383596/Read-stream-until-space-is-found-(space-?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
// Read stream until space is found (space, new line, tab or comment). Returns // number of bytes read. Stream's position will point to the next // byte coming after the first found space byte. private static int ReadUntilSpace(Stream stream, byte[] buffer, int start) { byte nextByte = (byte)stream.ReadByte(); int bytesRead = 0; while ((nextByte != ' ') && (nextByte != '\n') && (nextByte != '\r') && (nextByte != '\t') && (nextByte != '#')) { buffer[start + bytesRead] = nextByte; bytesRead++; nextByte = (byte)stream.ReadByte(); } return bytesRead; }
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus