[liblouis-liblouisxml] Re: Help! C programmers

  • From: "John J. Boyer" <john.boyer@xxxxxxxxxxxxxxxxx>
  • To: liblouis-liblouisxml@xxxxxxxxxxxxx
  • Date: Tue, 6 Aug 2013 06:33:11 -0500

Paul,

I hope you find helpers. We need more peiple working on liblouisutdml. 
As you know, my priority is fixing bugs and implementing new features 
needed by BrailleBlaster.

John

On Tue, Aug 06, 2013 at 11:39:22AM +0100, PaulWood wrote:
> Hi guys,
> I'm trying to truncate the running header at a space so we don't get 
> half a word or in a test case we just got a capitol sign!
> Anyway I've written a routine to truncate at the last space before the 
> truncate length but then I look at the code and the 'string' definition 
> refers to widechar, but when I find the definition of widechar at line 
> 33 of liblouis.h it says:
> #define widechar unsigned short int
> 
> How can a string be an int!
> 
> Here is my test routine in case it helps.
> Thanks
> Paul
> 
> #include <stdio.h>
> #include <string.h>
> 
> int main ()
> {
>   char str[] = "This is t h ";
>   char * pch;
>   char str1[40];
>   int lenstr1;
>   int length=10;
>   printf ("Looking for the 'space' character in \"%s\"...\n",str);
>   pch=str;
>   lenstr1=strlen(str);
>   while (pch!=NULL && (pch-str)<=length)
>   {
>    strncpy ( str1, str, pch-str ); /* Save previous string */
>    lenstr1=(pch-str); /* Save previous length of string */
>    pch=strchr(pch+1,' '); /* Find next space */
>     printf ("found at %d\n pch is %s\n",pch-str+1,pch);
> 
>   }
>   if (lenstr1==0) { /* i.e. Not found any spaces */
>       strncpy ( str1, str, strlen(str) );
>       lenstr1=strlen(str);
>   }
>   str1[lenstr1] = '\0'; /* add Null as required */
>   printf("string is:\"%s\"\n",str1);
>   return 0;
> }
> For a description of the software, to download it and links to
> project pages go to http://www.abilitiessoft.com

-- 
John J. Boyer; President, Chief Software Developer
Abilitiessoft, Inc.
http://www.abilitiessoft.com
Madison, Wisconsin USA
Developing software for people with disabilities

For a description of the software, to download it and links to
project pages go to http://www.abilitiessoft.com

Other related posts: