Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 03-25-2004, 03:58 PM   #1
Senior Member
Registered: Mar 2003
Location: Pittsburgh, PA
Distribution: Gentoo / NetBSD
Posts: 1,251

Rep: Reputation: 45
XDrawString and carriage returns

All, I am writing using XLib to write a little app. And I've been using XDrawString to display text.

However I've come across a situation where I want to display a string with embedded carriage returns:
char *str = "Hello there.\n How are you today?";

However when I display the string using XDrawString the carriage return doesn't translate and the multiple lines get displayed on a single line
Hello there. How are you today?

instead of:
Hello there.
How are you today?

Can anyone point me to a function that WILL properly display the carriage return, or perhaps is there a different way to encode the carriage return so that XDrawString will planes the lines each on their own line? Or am I stuck breaking the strings apart and displaying them one after the other?

Thanks for any advice,
Old 03-25-2004, 04:07 PM   #2
Senior Member
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 51
im not an expert on XLib but with experience from other api's i reckon your gonna have to break it up yourself.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
adding carriage returns Zxarr Programming 7 09-20-2005 06:44 AM
How to remove carriage returns in a bunch of perl scripts? rebel Red Hat 4 04-12-2005 03:27 PM
Carriage Returns Thorkyl Linux - Software 7 06-28-2004 06:42 PM
Kword: How to remove carriage returns? RockyRed Linux - Newbie 1 07-21-2003 07:52 AM
Carriage Returns Trouble sancho5 Linux - General 2 08-29-2001 09:59 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:45 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration