Hi All,
I'm looking for a way to convert a buffer into text (represent buffer
as text).
The text is read by a parser that needs to cut it at a special
character that is not part of the buffer (E.g.end of line).
(I think this is similar to the method used to 'textualize' binary
data in HTML (to display special characters?) )
For exapmle:
A parser parses the following command line to invoke the function
"Foo" with the relevant parameter
(Command line is all text) :
"Foo(xxx)\n"
Now, I need to receive the same command line with the argument
represented in binary and not in text, and still be able to parse it.
Is there a .Net Class that knows to represent binary in a text format?
Thanks,
Udi. 4 1248
On 5 Mar, 15:56, "Udi" <UdiBenSen...@gmail.comwrote:
Hi All,
I'm looking for a way to convert a buffer into text (represent buffer
as text).
The text is read by a parser that needs to cut it at a special
character that is not part of the buffer (E.g.end of line).
(I think this is similar to the method used to 'textualize' binary
data in HTML (to display special characters?) )
For exapmle:
A parser parses the following command line to invoke the function
"Foo" with the relevant parameter
(Command line is all text) :
"Foo(xxx)\n"
Now, I need to receive the same command line with the argument
represented in binary and not in text, and still be able to parse it.
Is there a .Net Class that knows to represent binary in a text format?
Thanks,
Udi.
Would this help?
//First working on a real string
byte[] b;
string s3;
System.Text.ASCIIEncoding en = new System.Text.ASCIIEncoding();
b = en.GetBytes("This is a test2\n".ToCharArray());
s3 = en.GetString(b);
Console.WriteLine(s3);
//now working on non printables.
b = new byte[] {1,2,3,4,5,6,7,255,9,10};
s3 = en.GetString(b);
Console.WriteLine(s3);
On Mar 5, 6:29 pm, "DeveloperX" <nntp...@operamail.comwrote:
On 5 Mar, 15:56, "Udi" <UdiBenSen...@gmail.comwrote:
Hi All,
I'm looking for a way to convert a buffer into text (represent buffer
as text).
The text is read by a parser that needs to cut it at a special
character that is not part of the buffer (E.g.end of line).
(I think this is similar to the method used to 'textualize' binary
data in HTML (to display special characters?) )
For exapmle:
A parser parses the following command line to invoke the function
"Foo" with the relevant parameter
(Command line is all text) :
"Foo(xxx)\n"
Now, I need to receive the same command line with the argument
represented in binary and not in text, and still be able to parse it.
Is there a .Net Class that knows to represent binary in a text format?
Thanks,
Udi.
Would this help?
//First working on a real string
byte[] b;
string s3;
System.Text.ASCIIEncoding en = new System.Text.ASCIIEncoding();
b = en.GetBytes("This is a test2\n".ToCharArray());
s3 = en.GetString(b);
Console.WriteLine(s3);
//now working on non printables.
b = new byte[] {1,2,3,4,5,6,7,255,9,10};
s3 = en.GetString(b);
Console.WriteLine(s3);- Hide quoted text -
- Show quoted text -
I don't know.
What would happen if one of the bytes in b has the value of '\n'?
How will this be represented in s3?
I'll test it.
Thanks. :)
On Mar 5, 6:29 pm, "DeveloperX" <nntp...@operamail.comwrote:
On 5 Mar, 15:56, "Udi" <UdiBenSen...@gmail.comwrote:
Hi All,
I'm looking for a way to convert a buffer into text (represent buffer
as text).
The text is read by a parser that needs to cut it at a special
character that is not part of the buffer (E.g.end of line).
(I think this is similar to the method used to 'textualize' binary
data in HTML (to display special characters?) )
For exapmle:
A parser parses the following command line to invoke the function
"Foo" with the relevant parameter
(Command line is all text) :
"Foo(xxx)\n"
Now, I need to receive the same command line with the argument
represented in binary and not in text, and still be able to parse it.
Is there a .Net Class that knows to represent binary in a text format?
Thanks,
Udi.
Would this help?
//First working on a real string
byte[] b;
string s3;
System.Text.ASCIIEncoding en = new System.Text.ASCIIEncoding();
b = en.GetBytes("This is a test2\n".ToCharArray());
s3 = en.GetString(b);
Console.WriteLine(s3);
//now working on non printables.
b = new byte[] {1,2,3,4,5,6,7,255,9,10};
s3 = en.GetString(b);
Console.WriteLine(s3);- Hide quoted text -
- Show quoted text -
No. This won't help. I tested it and the last byte in b (10) is
displayed as '\n', and this is what I need to prevent.
Isn't there any class that would change it to something like '
'
just like it is done done with HTMLs?
On 6 Mar, 07:46, "Udi" <UdiBenSen...@gmail.comwrote:
On Mar 5, 6:29 pm, "DeveloperX" <nntp...@operamail.comwrote:
On 5 Mar, 15:56, "Udi" <UdiBenSen...@gmail.comwrote:
Hi All,
I'm looking for a way to convert a buffer into text (represent buffer
as text).
The text is read by a parser that needs to cut it at a special
character that is not part of the buffer (E.g.end of line).
(I think this is similar to the method used to 'textualize' binary
data in HTML (to display special characters?) )
For exapmle:
A parser parses the following command line to invoke the function
"Foo" with the relevant parameter
(Command line is all text) :
"Foo(xxx)\n"
Now, I need to receive the same command line with the argument
represented in binary and not in text, and still be able to parse it.
Is there a .Net Class that knows to represent binary in a text format?
Thanks,
Udi.
Would this help?
//First working on a real string
byte[] b;
string s3;
System.Text.ASCIIEncoding en = new System.Text.ASCIIEncoding();
b = en.GetBytes("This is a test2\n".ToCharArray());
s3 = en.GetString(b);
Console.WriteLine(s3);
//now working on non printables.
b = new byte[] {1,2,3,4,5,6,7,255,9,10};
s3 = en.GetString(b);
Console.WriteLine(s3);- Hide quoted text -
- Show quoted text -
No. This won't help. I tested it and the last byte in b (10) is
displayed as '\n', and this is what I need to prevent.
Isn't there any class that would change it to something like '
'
just like it is done done with HTMLs?- Hide quoted text -
- Show quoted text -
Well \n is 10, can you give a slightly bigger example? I'm sure I'm
missing something. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: inkapyrite |
last post by:
Hi all. I'm using ifstream to read from a named pipe but
i've encountered an annoying problem. For some reason, the
program blocks on reading an ifstream's internal buffer that's
only half-filled....
|
by: ma740988 |
last post by:
A few days ago I recieved yet again advice on implementing a buffer of
bytes. At issue: (part 1) how do I take the contents of a struct,
then dump (used sparingly) it into a byte buffer. ...
|
by: William Stacey |
last post by:
Working with implementing a circular buffer for a producer/consumer deal.
Have not done one in a while. The following seems to work. However, I
remember and have seen other implementation that...
|
by: Bill Sun |
last post by:
Hi,
I have a quetion about to refresh the ostringstream buffer: like this.
ostringstream buffer;
buffer << 245;
// then the buffer.str() = "245";
......
|
by: nickdu |
last post by:
I usually try to stay away from _alloca(). However, I'm considering using it
for a logging function. Our current logging function maintains its own
buffer which it grows to fit the string being...
|
by: arnuld |
last post by:
this is from mentioned section. i did not understand some things here:
it means "flushing the buffer" and "writing to output device" are SAME
thing, these are just 2 different names for the...
|
by: aki |
last post by:
Hi all,
i am writing codes for implementing network protocols.
i have written a method which is receiving a packet from network.
i have assumed that the packet i will receive will be of type...
|
by: martinmercy2001 |
last post by:
Could any body help me with creating a ring buffer class using a string. use memory circular buffer not an IO buffer. just read, write and seek method. Read method should take anumber and return the...
|
by: James Harris |
last post by:
Initial issue: read in an arbitrary-length piece of text.
Perceived issue: handle variable-length data
The code below is a suggestion for implementing a variable length
buffer that could be used...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |