473,394 Members | 1,960 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,394 software developers and data experts.

Non Null Terminated string

Hi,
Is there anything called Non Null Terminated string (may be in UTF or
something) i.e. a string which does not have a '\0' at the end to
terminate.
In that case how can the end be identified?

Thanks in advance

regards,

Raghu
Sep 15 '05 #1
4 6846
Raghavendra Mahuli napsal(a):
In that case how can the end be identified?


You will have to know exact length of the string if you don't want to
use null terminated string. In such case the information about length is
usually placed before the string (first four bytes).

Y.
Sep 15 '05 #2
Hi Yandos,

Ok, Thanks ..
But is it used a standard format like stl::string or roguewave string?

regards,
raghu
"Yandos" <fa******@fakeisp.cz> wrote in message
news:43**********@x-privat.org...
Raghavendra Mahuli napsal(a):
In that case how can the end be identified?


You will have to know exact length of the string if you don't want to
use null terminated string. In such case the information about length is
usually placed before the string (first four bytes).

Y.

Sep 15 '05 #3
> Hi,
Is there anything called Non Null Terminated string (may be in UTF or
something) i.e. a string which does not have a '\0' at the end to
terminate.
In that case how can the end be identified?


Yes. Take a look at std::basic_string<> template and std::string and
std::wstring typedef's.

Ben
Sep 15 '05 #4
In message <dg**********@ns2.fe.internet.bosch.com>, Raghavendra Mahuli
<ra************@in.bosch.com> writes
Hi,
Is there anything called Non Null Terminated string (may be in UTF or
something) i.e. a string which does not have a '\0' at the end to
terminate.
std::basic_string (and hence std::string and std::wstring) can contain
nulls and need not be terminated by one.
In that case how can the end be identified?


When constructing or assigning to it, by using the forms of the
constructor or the insert(), assign(), append() etc. functions which
take a pointer and a count, or two iterators. When obtaining its value,
by using the data() and size() functions.

--
Richard Herring
Sep 15 '05 #5

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

Similar topics

35
by: David Mathog | last post by:
Every so often one of my fgets() based programs encounters an input file containing embedded nulls. fgets is happy to read these but the embedded nulls subsequently cause problems elsewhere in...
15
by: ehabaziz2001 | last post by:
Hi, Till now I do not understand how the null character automatically added to the end of the string and it is not an element of the string array . All books said the null character (\0) added...
3
by: Michel Racicot | last post by:
I need to read a null terminated ASCII string from a FileStream. How can I do that? I know that with FileStream.ReadByte, I can read until I get a byte == 0 but how can I convert a single byte to...
2
by: Ithaqua | last post by:
How do you create them? -- Cheers Ithaqua
3
by: Carlo Stonebanks | last post by:
I need to read a binary file which has mixed data types embedded in it. Fixed length strings, 16-bit integers and zero (null) terminated ASCII strings. (akak ASCIIZ) The first two types are no...
2
by: Steve Barnett | last post by:
I need to call a Win32 function that returns a set of string values. Each value is terminated by a null and the last value is terminated by two nulls. How do I code for this in C#? The call is:...
21
by: Michael | last post by:
Hi All, I've received (via UDP) a null terminated string and need to convert it into a Python string. Can anyone tell me how this is done? If it helps, I know the number of characters in the...
12
by: semut | last post by:
Given that the string is of null terminated type. What could be the possible causes (by experience) the string to have no null terminated and cause buffer overflow later. I know it is quite broad,...
7
by: semut | last post by:
Given that the string is of null-terminated type. What could be the possible causes (by experience) the string to have no null character (\0) and cause buffer overflow later. I know it is quite...
5
by: ssylee | last post by:
If I'm being supplied with a char* that is not null-terminated, is it impossible to transform it into a null terminated char* with only abstract information about the char* information?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
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...
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
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...
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
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...

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.