?
Solved

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

Posted on 2004-09-08
1
Medium Priority
?
270 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 45

Accepted Solution

by:
sunnycoder earned 400 total points
ID: 12013351
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
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 and use structures 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.

801 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