* RE: Converting Mod types to Character types...
@ 2001-05-14 23:34 Beard, Frank
2001-05-15 8:47 ` chris.danx
0 siblings, 1 reply; 4+ messages in thread
From: Beard, Frank @ 2001-05-14 23:34 UTC (permalink / raw)
To: 'comp.lang.ada@ada.eu.org'; +Cc: 'chris.danx@ntlworld.com'
Actually, since modular types fall into the universal integer
category, the conversion is even easier:
char : character := ' ';
uc : Interfaces.C.unsigned_char := 65;
begin
char := character'val(uc); -- char is now 'A'
Frank
-----Original Message-----
From: chris.danx [mailto:chris.danx@ntlworld.com]
Sent: Monday, May 14, 2001 6:50 PM
To: comp.lang.ada@ada.eu.org
Subject: Converting Mod types to Character types...
Hi,
I've got my interface to Vx thing working but i want to display the
contents
of the information it retrieves. I've got Interfaces.C.Unsigned_Char types
in
an array and this maps to a Mod type in GNAT. I've tried allsorts of
conversions between a single C.UC to character and unsigned conversions too.
How do i convert between them? It's annoying since this is the only thing
that's not working, everything else is.
Thanks,
Chris Campbell
_______________________________________________
comp.lang.ada mailing list
comp.lang.ada@ada.eu.org
http://ada.eu.org/mailman/listinfo/comp.lang.ada
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: Converting Mod types to Character types...
@ 2001-05-14 23:30 Beard, Frank
0 siblings, 0 replies; 4+ messages in thread
From: Beard, Frank @ 2001-05-14 23:30 UTC (permalink / raw)
To: 'comp.lang.ada@ada.eu.org'; +Cc: 'chris.danx@ntlworld.com'
Since Interfaces.C does not supply a "To_Ada" function for
unsigned_char as it does for the other character types, and
you presumably aren't supposed to assume a correlation between
Interfaces.C.char and Interfaces.C.unsigned_char, then you
will have to convert it yourself.
This is assuming you're asking how to convert between
Interfaces.C.unsigned_char and character, then the simplest
way is probably:
char : character := ' ';
uc : Interfaces.C.unsigned_char := 65;
begin
char := character'val(integer(uc)); -- char is now 'A'
Is this what you were asking?
Frank
-----Original Message-----
From: chris.danx [mailto:chris.danx@ntlworld.com]
Sent: Monday, May 14, 2001 6:50 PM
To: comp.lang.ada@ada.eu.org
Subject: Converting Mod types to Character types...
Hi,
I've got my interface to Vx thing working but i want to display the
contents
of the information it retrieves. I've got Interfaces.C.Unsigned_Char types
in
an array and this maps to a Mod type in GNAT. I've tried allsorts of
conversions between a single C.UC to character and unsigned conversions too.
How do i convert between them? It's annoying since this is the only thing
that's not working, everything else is.
Thanks,
Chris Campbell
_______________________________________________
comp.lang.ada mailing list
comp.lang.ada@ada.eu.org
http://ada.eu.org/mailman/listinfo/comp.lang.ada
^ permalink raw reply [flat|nested] 4+ messages in thread
* Converting Mod types to Character types...
@ 2001-05-14 22:49 chris.danx
0 siblings, 0 replies; 4+ messages in thread
From: chris.danx @ 2001-05-14 22:49 UTC (permalink / raw)
Hi,
I've got my interface to Vx thing working but i want to display the contents
of the information it retrieves. I've got Interfaces.C.Unsigned_Char types in
an array and this maps to a Mod type in GNAT. I've tried allsorts of
conversions between a single C.UC to character and unsigned conversions too.
How do i convert between them? It's annoying since this is the only thing
that's not working, everything else is.
Thanks,
Chris Campbell
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2001-05-15 8:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-14 23:34 Converting Mod types to Character types Beard, Frank
2001-05-15 8:47 ` chris.danx
-- strict thread matches above, loose matches on Subject: below --
2001-05-14 23:30 Beard, Frank
2001-05-14 22:49 chris.danx
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox