From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f0ecd5ca045c4f0b X-Google-Attributes: gid103376,public From: Niklas Holsti Subject: Re: char -> int Date: 1998/11/18 Message-ID: <36534312.F796928E@icon.fi>#1/1 X-Deja-AN: 413277451 Content-Transfer-Encoding: 7bit References: <36527480.5A60@usa.net> Content-Type: text/plain; charset=us-ascii Organization: Space Systems Finland Ltd Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 1998-11-18T00:00:00+00:00 List-Id: alex wrote: > > How do I cast char to an int using ada? This, and most of your later questions, are too short and general to permit good and concise answers. Please, first read an Ada book, or go through one of the Ada tutorials available on the net, then try to solve your problem on your own, then if you still have a problem, ask us again, but please include more information on what your problem (= application) really is, and (just in case it's relevant) which computer, operating system, and compiler you are using. Books, reference manuals and tutorials can be found at http://www.adahome.com/. I've listed your questions (well, all questions that are now on my news server) below, and added some references to the Ada 95 Language Reference Manual where the answers can be found. Links to the LRM are at http://www.adahome.com/Resources/References.html. Note that the LRM is not an elementary or tutorial text, so you may want to find the corresponding sections of an Ada textbook instead. > How do I cast char to an int using ada? LRM 3.5.5 (that's section 3.5.5), 'Pos and 'Val attributes. Check also LRM 3.5.2. > How do I dail a number using phone device with ada? Depends on your computer, OS and modem. Probably you need to write some "AT" commands to a serial port; the way you do this varies across systems, but on some systems it's as simple as opening a text file with the name of the serial port (LRM A.10.2; Text_IO.Open) and writing a string (Text_IO.Put_Line). > How do I page someone with ada ? Same as above. > How do I send email with ada? Depends on your OS and mail system. You probably need to start a mail agent as a subprocess and point it at your message. On UNIX/POSIX systems, a standard Ada binding of the necessary OS services exists; look for the "Florist" package on the net, or check your compiler documentation. > How do I delete a node using ada? As above (I interpret "node" to mean a file system node, e.g. a file). "Florist" contains the services for UNIX systems; MS-Windows bindings also exist (I believe the name is Win32Ada). > How do i start a window application with ada Start it as a child process, using "Florist". If you want to write a window application in Ada, use a binding appropriate for your windowing system (CLAW and TASH are some of the nice, thick ones). > how do i get the *69 number from phone device with ada to record > numbers on callingfor a program I haven't the faintest idea what you mean, but probably you need to write some command to your modem and read its answer. Text_IO on the serial port is one way. > How do I get the eof from header using ada ? What "header"? Look at LRM annexes A.6 through A.14 for input-output in Ada, including functions to detect end of file. > How to i treat exception and redirect them inside the program ? LRM 11 (an entire chapter about exception handling!) > How do I define a generic parameter that would let say in want to passe > sometime a Natural and sometime a stirng LRM 12 (an entire chapter about generic units). It depends a little on what you want to use the parameter for. > How do I change a bit inside byte using ada Like i'd do with assembler ? LRM 13, and specifically LRM 13.5, discusses bit-level data layouts. Check also the boolean operations for modular types, LRM 3.5.4 and specifically 3.5.4(31) (the "31" is the paragraph number). > Hi I'd like to know how to position a pointer in a file LRM A.8.5, procedure Set_Index for a file of homogeneous records. LRM A.12 for stream files. "Florist" or other O/S bindings can of course also be used, but then you may have to read/write the file using services of that binding, for coherent buffering. > Hi I'd like to define a variable size record but I have a compile error. > > what can I do ? > > Ex; TYPE TAB IS RECORD > Str :STRING(1..M); > Char :CHARACRER; > END RECORD; Ok this question is specific enough to be answered briefly: make the size a discriminant of the record type. See LRM 3.7(33). In your example, TYPE TAB (M : Natural) IS RECORD > How do I use a asm (assembleur) lib withusing ada? Declare the library routines in your Ada source with pragma Import. List the object code files for linking with pragma Linker_Options. Note that you must find out about parameter passing conventions specific for your compiler and assembler; check pragma Convention. All this stuff is in LRM B.1. Hope the above helps you a bit. It would be more interesting to answer your questions if you could say a little about the context, such as what type of application you are working on.