473,408 Members | 2,444 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Output Ascii 0x02 as part of record

I am writing an interface file to a vendor. The requirements say:

Format of the text: Text must be in the format as you would like it to
appear without embedded newline characters. Instead of newline
characters, use ASCII character 0x02. A blank like would be
represented by two 0x02 characters in a row.

I am having a hard time figuring out how to output this. i have tried
a few things such as

Dim twoAsbyte As Byte = &H2

my output has a "2" wherever i put it instead of an unprintable
character.

So the text would look like:

This is a lineone0x02this is line two0x020x02this is line 4

where 0x02 would really display unprintable characters

Thanx

May 2 '07 #1
7 9298
Hello LLcoolQ,
characters, use ASCII character 0x02. A blank like would be
represented by two 0x02 characters in a row.
this is not an ASCII text, but a binary as every character with a value
less than 32 (space) is unprintable. Therefore, you might want to write
the file in binary mode.

You can (like in traditional VB) use the "Open" command or to use the
BinaryWriter class ("How to: Read and Write to a Newly Created Data File
" gives you an example how to do it).

Best regards,

Martin
May 2 '07 #2
>I am having a hard time figuring out how to output this.
Try using ChrW(2)
Mattias

--
Mattias Sjgren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
May 2 '07 #3
thanx, thats what i figured.

wanted to avoid doing that
Hello LLcoolQ,
>characters, use ASCII character 0x02. A blank like would be
represented by two 0x02 characters in a row.
this is not an ASCII text, but a binary as every character with a
value less than 32 (space) is unprintable. Therefore, you might want
to write the file in binary mode.

You can (like in traditional VB) use the "Open" command or to use the
BinaryWriter class ("How to: Read and Write to a Newly Created Data
File " gives you an example how to do it).

Best regards,

Martin

May 2 '07 #4
will give it a try in the morning, thanx
>I am having a hard time figuring out how to output this.
Try using ChrW(2)

Mattias

May 2 '07 #5
On May 2, 5:54 pm, Mattias Sjgren <mattias.dont.want.s...@mvps.org>
wrote:
I am having a hard time figuring out how to output this.

Try using ChrW(2)

Mattias

--
Mattias Sjgren [C# MVP] mattias @ mvps.orghttp://www.msjogren.net/dotnet/|http://www.dotnetinterop.com
Please reply only to the newsgroup.
That was it, thanx much

recordOut.Append(arrValues(0))
recordOut.Append(ChrW(2))

May 3 '07 #6
Hi,

All characters below decimal 127 (&H7F) are ASCII. You do not need to do
anything special with them. In VB 0x02 is Chr(2).

--
Richard Grier, MVP
Hard & Software
Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
Edition,
ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
2006.
See www.hardandsoftware.net for details and contact information.
May 3 '07 #7
Hi,

All characters below decimal 127 (&H7F) are ASCII. You do not need to do
anything special with them. In VB 0x02 is Chr(2). Example:

Dim STX As String = Chr(2)

STX is the ASCII character called StartOfText. This character is used by
some systems as a marker to indicate the start of a text string. Another
common character is ETX (Chr(3)) EndOfText, which might be used to indicate
the end of a string. These characters do not print, but they still are
ASCII text characters and may be used as part of a String variable.

Dick

--
Richard Grier, MVP
Hard & Software
Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
Edition,
ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
2006.
See www.hardandsoftware.net for details and contact information.
May 3 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Tim Meagher | last post by:
I am using the XslTransform class in C#.net to output XML files that include non-ascii Unicode characters such as the Greek capital letter theta U+0398. I can easily outout the data as serialized...
11
by: Roger Leigh | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 The program listed below demonstrates the use of wcsftime() and std::time_put<wchar_t> which is a C++ wrapper around it. (I know this isn't C; but...
0
by: Tim Meagher | last post by:
I am using the XslTransform class in C#.net to output XML files that include non-ascii Unicode characters such as the Greek capital letter theta U+0398. I can easily outout the data as serialized...
6
by: Kai Bhli | last post by:
Hi all ! I've got a lot of feedback from (the always helpful) Jon Skeet on this subject before. Dispite this I'm still not there - due to my own lack of knowledge of course. Anyway, I'm...
1
by: Sathyaish | last post by:
I have the following scenario: Algorithm: 3DES Cipher Mode: CBC Key Size: 128-bit Block Size: 64 bit IV: 0x0000000000000000 (an eight byte array of zeros) The results I get using .NET with...
8
by: Alec MacLean | last post by:
Hi, I'm using the DAAB Ent Lib (Jan 2006) for .NET 2.0, with VS 2005 Pro. My project is a Web app project (using the WAP add in). Background: I'm creating a survey system for our company, for...
17
by: Gregor Kovač | last post by:
Hi! Does DB2 handle extended ASCII table? Example: VALUES(CHR(65)) =A VALUES(CHR(129)) =null, but according to www.asciitable.com should be u with umlaut. Any idea ?
6
by: Hongbo | last post by:
Hi, I use System.Security.Cryptography.HashAlgorithm.ComputeHash() method with SHA512 to encrypt password. I recently upgrade my website from .Net 1.1 to .Net 2.0. The passwords stop working....
2
by: Jcan | last post by:
HI I have a 10 digit ASCII array: char Arr = {'1','2','3','4','5','6','7','8','9','1'} I have to convert the the array to decimal. I do this by subtracting 0x30 and multiplying with...
0
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
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,...
0
jinu1996
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...
0
tracyyun
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...
0
isladogs
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.