ÌÌÌÌÌÌÌÌÌÌ characters in string C programming

Posted on 2008-11-14
Medium Priority
Last Modified: 2012-06-27
I am maintaining some old C programs using BTrieve databases.  When I move the contents of a database field into a string, it is padded with  ÌÌÌÌÌÌÌÌÌÌ characters at the end of the string.  What are these and how can I get rid of them.  I am moving the 50 character database field to a string array of 51 characters using the strncpy command.
strncpy(strLongName, MhfsHdr.LongName, 50);
strcpy(CompanyName, strLongName);

Open in new window

Question by:pwiginton
1 Comment
LVL 53

Accepted Solution

Infinity08 earned 500 total points
ID: 22961978
The idea is to retrieve the length of the field, and then :

        strLongName[length] = '\0';

to terminate the string.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.
Suggested Courses
Course of the Month15 days, 11 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question