ex.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
SSEGADD Function Example
                        Example                Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
' This example uses the SSEGADD function to obtain the Basic string address
' of a string used by a C procedure. The Basic program calls the printmessage
' C procedure which, in turn, calls Basic to obtain the string address.
 
' Note: To run this example, you must first compile the C procedure (shown
' below in remarks) and either incorporate it in a Quick library or link it
' to the compiled Basic program.
 
' To run this example:
' 1. Choose New Project from the File menu
' 2. Copy the code example below to the code window
' 3. Press F5 to run the example
 
 DEFINT A-Z
 DECLARE SUB printmessage CDECL (BYVAL farstring AS LONG)
 
 CLS                                  ' Clear the screen
' Create the message as an ASCIIZ string, as required by the C printf
' function.
 a$ = "This is a short example of a message" + CHR$(0)
 CALL printmessage(SSEGADD(a$))       ' Call the C procedure with pointers
 
' /* C Routine printmessage */
' /* Prints a BASIC far string on the screen.*/
'
' #include <stdio.h>
'
' /* Define a procedure which inputs a string far pointer */
' void  printmessage (char far *farpointer)
'    {
'    /* print the string addressed by the far pointer */
'    printf( "%s\n", farpointer);
'    }
'