-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgettext.cc
66 lines (46 loc) · 1.1 KB
/
gettext.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
-------------------------------------------------------------------------
OBJECT NAME: gettext.cc
FULL NAME: Retreive values from text widgets.
ENTRY POINTS: GetTextFloat()
GetTextInt()
GetTextString()
STATIC FNS: none
DESCRIPTION:
COPYRIGHT: University Corporation for Atmospheric Research, 1998
-------------------------------------------------------------------------
*/
#include <cstdlib>
#include <string>
#define register
#include <Xm/TextF.h>
using namespace std;
/* -------------------------------------------------------------------- */
int GetTextInt(const Widget w)
{
char *p;
int n;
p = XmTextFieldGetString(w);
n = atoi(p);
XtFree(p);
return(n);
}
/* -------------------------------------------------------------------- */
float GetTextFloat(const Widget w)
{
char *p;
float x;
p = XmTextFieldGetString(w);
x = atof(p);
XtFree(p);
return(x);
}
/* -------------------------------------------------------------------- */
void GetTextString(const Widget w, string& s)
{
char *p;
p = XmTextFieldGetString(w);
s = p;
XtFree(p);
}
/* END GETTEXT.CC */