Solved

C/Motif/*nix: how to append text in an output window?

Posted on 2004-09-08
1
223 Views
Last Modified: 2010-04-15
I've created a simple Scrolled Text area for displaying information to the user during runtime of my app.  How can I append text to this text area?  Essentially I want to use it like a scrollable xterm.  In Java, this is two easy steps once the text area is created:
               OutputWindow.append (text);
               OutputWindow.setCaretPosition ();   // to auto scroll down to the bottom

All the examples I've seen for Motif require creating a buffer yourself, appending new text to the buffer (and managing the allocated space), then using XmTextSetString (output_window,buffer);  Is there an easier way, maybe equivalent to how Java does it?
0
Comment
Question by:jimdgar
1 Comment
 
LVL 45

Accepted Solution

by:
sunnycoder earned 100 total points
Comment Utility
Hi jimdgar,

Java handles memory management for you. C is not so generous. It expects the programmer to handle its own memory mangement. I do not think you will find the exact Java equivalent APIs in C. There will be some sort of memory management involved on your part at some point.

That been said, I have not worked with X-Motif but I have worked with few GUI libs like Qt and Gtk and usual method is to create a buffer, put in a string and then call a SetString kind of function. It is upto the programmer to free the allocated memory later.

sunnycoder
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

762 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now