home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / softc101.zip / SOFTC.MAN < prev    next >
Text File  |  1989-02-15  |  240KB  |  5,777 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.                            SoftC Library Reference Manual
  18.  
  19.                                     Version 1.01
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.                       Manual and Software Copyright 1988, 1989
  41.                                          by
  42.                                    K. L. Schumann
  43.                             16820 3rd Street North East
  44.                              Ham Lake, Minnesota 55304
  45.                                    (612) 434-6968
  46.  
  47.                                 ALL RIGHTS RESERVED
  48.  
  49.  
  50.  
  51.  
  52.  
  53.             This document describes version 1.01 of the SoftC Library,
  54.             created in February 1989.
  55.  
  56.  
  57.  
  58.  
  59.  
  60.                                      DISCLAIMER
  61.  
  62.  
  63.             The  author  makes  no  representation  or  warranties  with
  64.             respect to  this  product  and  specifically  disclaims  any
  65.             implied warranties  or merchantability  or fitness  for  any
  66.             particular purpose.  The author shall have no liability with
  67.             respect  to   his  obligations   under  this  agreement  for
  68.             compensatory,   special,   incidental,   consequential,   or
  69.             exemplary damages.
  70.  
  71.  
  72.             The author further reserves the right to make changes to the
  73.             specifications of  the library  and contents  of the  manual
  74.             without obligation  to notify any person or organizations of
  75.             such changes.
  76.  
  77.  
  78.                                   Table of Contents
  79.  
  80.  
  81.             Chapter 1 Introduction................................ 1
  82.                 Registration...................................... 2
  83.                 User Supported Software........................... 2
  84.                 Typographic Conventions........................... 3
  85.                 Trademarks........................................ 3
  86.                 Support and Updates............................... 3
  87.                 The Future........................................ 3
  88.             Chapter 2 Before You Begin............................ 4
  89.                 The READ.ME File.................................. 4
  90.                 Installing SoftC on Your System................... 4
  91.                 SoftC Applications................................ 5
  92.                 Compiling with Turbo C............................ 6
  93.                 Recompiling the SoftC Libraries................... 6
  94.                 Function Naming Conventions....................... 6
  95.             Chapter 3 A Windows Toolkit Tutorial.................. 7
  96.                 Basic Rules....................................... 7
  97.                 Screen Output..................................... 8
  98.                 Cursor Control.................................... 8
  99.                 Erase Functions................................... 9
  100.                 Character Colors.................................. 9
  101.                 Window Control.................................... 9
  102.                 Window Colors..................................... 10
  103.                 Window Border Styles.............................. 10
  104.                 Window Titles..................................... 10
  105.             Chapter 4 A dBase III Toolkit Tutorial................ 11
  106.                 Sequential Files.................................. 11
  107.                 Random Access Files............................... 11
  108.                 Keys.............................................. 11
  109.                 ISAM and B-trees.................................. 12
  110.                 Basic Rules....................................... 13
  111.                 Data File Functions............................... 13
  112.                 Data Record I/O................................... 13
  113.                 Data Field I/O.................................... 14
  114.                 Index File Functions.............................. 15
  115.                 Index Page Functions.............................. 15
  116.                 Index Key Functions............................... 15
  117.             Chapter 5 Clock & Calendar Functions.................. 17
  118.             Chapter 6 Miscellaneous Functions..................... 18
  119.             Chapter 7 The SoftC Library........................... 19
  120.                 sccday............................................ 21
  121.                 sccddiff.......................................... 22
  122.                 sccdn2s........................................... 23
  123.                 sccds2n........................................... 24
  124.                 sccdvalid......................................... 25
  125.                 sccdxlat.......................................... 25
  126.                 sccleap........................................... 26
  127.                 sccleapi.......................................... 27
  128.                 sccmonth.......................................... 28
  129.                 scdclose.......................................... 29
  130.                 scdcreate......................................... 30
  131.                 scdfget........................................... 32
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.                                          iii
  139.  
  140.  
  141.                                   Table of Contents
  142.  
  143.  
  144.                 scdfgets.......................................... 33
  145.                 scdfinfo.......................................... 34
  146.                 scdfnam2no........................................ 36
  147.                 scdfput........................................... 37
  148.                 scdfputs.......................................... 38
  149.                 scdinfo........................................... 39
  150.                 scdopen........................................... 40
  151.                 scdrclear......................................... 41
  152.                 scdrcopy.......................................... 42
  153.                 scdrdel........................................... 43
  154.                 scdrget........................................... 44
  155.                 scdrinfo.......................................... 46
  156.                 scdrput........................................... 47
  157.                 scdrundel......................................... 48
  158.                 scdsize........................................... 49
  159.                 sceclr............................................ 50
  160.                 scemsg............................................ 51
  161.                 sciclose.......................................... 52
  162.                 scicreate......................................... 53
  163.                 sciexpr........................................... 54
  164.                 sciinfo........................................... 55
  165.                 scikadd........................................... 56
  166.                 scikcur........................................... 58
  167.                 scikdel........................................... 59
  168.                 scikfind.......................................... 60
  169.                 scikfirst......................................... 62
  170.                 sciklast.......................................... 63
  171.                 scikmake.......................................... 64
  172.                 sciknext.......................................... 67
  173.                 scikprev.......................................... 68
  174.                 scinit............................................ 69
  175.                 sciopen........................................... 70
  176.                 scipinfo.......................................... 71
  177.                 scipnum........................................... 72
  178.                 scterm............................................ 73
  179.                 scvers............................................ 74
  180.                 scwaget........................................... 74
  181.                 scwaput........................................... 75
  182.                 scwbget........................................... 76
  183.                 scwbput........................................... 78
  184.                 scwcget........................................... 79
  185.                 scwclose.......................................... 81
  186.                 scwclr............................................ 83
  187.                 scwclreol......................................... 83
  188.                 scwcput........................................... 84
  189.                 scwcursoff........................................ 85
  190.                 scwcurson......................................... 86
  191.                 scwgoto........................................... 87
  192.                 scwinfo........................................... 88
  193.                 scwopen........................................... 89
  194.                 scwopenx.......................................... 90
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.                                          iv
  202.  
  203.  
  204.                                   Table of Contents
  205.  
  206.  
  207.                 scwprintf......................................... 92
  208.                 scwputc........................................... 93
  209.                 scwputs........................................... 94
  210.                 scwselect......................................... 95
  211.                 scwtget........................................... 96
  212.                 scwtput........................................... 97
  213.                 scwxloc........................................... 98
  214.                 scwyloc........................................... 99
  215.             Index................................................. 100
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.                                           v
  265.  
  266.  
  267.           
  268.  
  269.  
  270.           Chapter 1          Chapter 1
  271.  
  272.  
  273.           Introduction          Introduction
  274.  
  275.  
  276.  
  277.  
  278.           C is generally considered to be a "bare-bones" language. A way to
  279.           put some flesh on those bones is to develop generalized functions
  280.           (extensions) which  may be  reused in many programs. The presence
  281.           of these  functions can make programming a quick and simple task.
  282.           The absence of these language extensions can mean many hours lost
  283.           "re-inventing the wheel".
  284.  
  285.  
  286.           Few programmers  have the time required to develop and debug such
  287.           a library  of functions.  This is  where  SoftC  comes  in.  This
  288.           library is  a collection  of  functions  designed  to  make  your
  289.           applications quicker  and easier to code and test. With the SoftC
  290.           library you  can spend time on your application not on developing
  291.           tools.
  292.  
  293.  
  294.           There also  is a  benefit to  using functions  found in a toolkit
  295.           library versus  using the  functions  found  in  your  compiler's
  296.           library. It  may seem  trivial, but  if you ever decide to change
  297.           compilers you  will find  that it will take many hours to convert
  298.           your source  to match  the new compiler's syntax. Using a generic
  299.           toolkit such as SoftC will eliminate that effort.
  300.  
  301.  
  302.           SoftC adds powerful capabilities to your function library:
  303.  
  304.  
  305.                -cursor positioning
  306.                -windowing
  307.                -screen output
  308.                -character attribute control
  309.                -date manipulation and calculation
  310.                -database data and index file functions
  311.  
  312.  
  313.           The SoftC  library is  intended for  use as  a supplement to your
  314.           compiler's object  libraries. It contains over seventy functions.
  315.           Currently is  has three  main features:  text windowing, dBaseIII
  316.           compatible data  and index  file manipulation, and clock/calendar
  317.           functions. The library is currently available only for Turbo C (I
  318.           am working on a Microsoft C version). These routines were written
  319.           in C.
  320.  
  321.  
  322.           The SoftC  library is the copyrighted property of K. L. Schumann.
  323.           You are granted a limited license to use the library, and to copy
  324.  
  325.  
  326.           2    Chapter 1, Introduction          2                           
  327.  
  328.  
  329.           and  distribute   the  following  files  (without  modification):
  330.           SOFTC.H, DBASE.H,  WINDOWS.H, SCTC20S.LIB, SOFTC.MAN, READ.ME and
  331.           REGISTER.
  332.  
  333.  
  334.           Registration          Registration
  335.  
  336.           If you  find this  library useful, you are encouraged to register
  337.           your copy  for only  $20. Once  registered you  will receive  two
  338.           diskettes containing  the complete  C source  for the library and
  339.           the remaining memory model libraries.
  340.  
  341.  
  342.           To register  print the  file "REGISTER",  read it,  and mail  the
  343.           completed form to:
  344.  
  345.  
  346.                                    Kim L. Schumann
  347.                              16820 3rd Street North East
  348.                               Ham Lake, Minnesota 55304
  349.  
  350.  
  351.           User Supported Software          User Supported Software
  352.  
  353.           This library  is user supported software. This means that you may
  354.           copy and  distribute it (under the conditions specified above) to
  355.           anyone at no cost. They are in turn requested to register if they
  356.           decide to use it.
  357.  
  358.  
  359.           The  user  supported  software  concept  (often  referred  to  as
  360.           shareware) is  an attempt to provide useful software at low cost.
  361.           The expense  of offering  a new  product by conventional means is
  362.           quite high  and thus  discourages many  independent  authors  and
  363.           small companies  from developing  and promoting their ideas. User
  364.           supported software  is an  attempt to  develop  a  new  marketing
  365.           channel where products can be introduced at minimum cost.
  366.  
  367.  
  368.           Everyone will  benefit if user supported software works. The user
  369.           benefits by  receiving quality products at low cost, and by being
  370.           able to test software thoroughly before purchasing it. The author
  371.           benefits by  being able  to enter  the commercial software market
  372.           without the need of large amounts of venture capital.
  373.  
  374.  
  375.           But it  can only  work with  your support.  If you  obtain a user
  376.           supported product  from a friend or coworker, and are still using
  377.           it after  a couple of weeks, then it is obviously worth something
  378.           to you, and a contribution should be sent.
  379.  
  380.  
  381.                                                Chapter 1, Introduction    3                                                                          3
  382.  
  383.  
  384.           Typographic Conventions          Typographic Conventions
  385.  
  386.           []             Square brackets enclose optional data.
  387.           Boldface       SoftC Library function names (such as          Boldface                                            
  388.                          scinit) and structure names when they                         scinit                               
  389.                           appear in text (but not in program
  390.                          examples).
  391.           Italics        indicate variable names (identifiers) that          _______                                 ___________      
  392.                          appear in text.
  393.  
  394.  
  395.           Trademarks          Trademarks
  396.  
  397.           Clipper is a registered trademark of Nantucket Software.
  398.           dBASEIII is a registered trademark of Ashton-Tate.
  399.           Microsoft is a registered trademark of Microsoft Corporation.
  400.           Turbo C is a registered trademark of Borland International.
  401.  
  402.  
  403.           Support and Updates          Support and Updates
  404.  
  405.           I will  only offer  advice and  technical support  to  those  who
  406.           contribute via  the shareware concept. Users who register will be
  407.           notified when updates and new products are available.
  408.  
  409.  
  410.           I can  be contacted  by telephone  at (612)  434-6968  after  6pm
  411.           Central Time,  via mail  at the registration address above, or on
  412.           GEnie through GE Mail at "K.SCHUMANN".
  413.  
  414.  
  415.           The Future          The Future
  416.  
  417.           There are  many enhancements  that could  be made to the dBaseIII
  418.           routines: make  them LAN multi-user, add functions found in dBase
  419.           which do not have a corresponding C function, and add support for
  420.           dBaseIII MEMO fields.
  421.  
  422.  
  423.           The window  toolkit was  written with  expansion  into  graphical
  424.           windows in  mind.  Adding  a  virtual  window  feature  could  be
  425.           incorporated if there is enough demand.
  426.  
  427.  
  428.           I would  like to  add pop-up,  and pull down menuing functions to
  429.           the library.  Formatted input  functions are  also on the "to do"
  430.           list.
  431.  
  432.  
  433.           Anyone wishing  to offer  advice and suggestions are most welcome
  434.           to do so.
  435.  
  436.  
  437.           
  438.  
  439.  
  440.           Chapter 2          Chapter 2
  441.  
  442.  
  443.           Before You Begin          Before You Begin
  444.  
  445.  
  446.  
  447.  
  448.           This chapter  supplies instructions for installing the library on
  449.           your hard disk and compiling the source.
  450.  
  451.  
  452.           The READ.ME File          The READ.ME File
  453.  
  454.           For  last   minute  update  information  not  contained  in  this
  455.           documentation, and/or a brief description of what's new with this
  456.           release please  read  the  READ.ME  file  found  on  the  library
  457.           diskette (or if you have the demonstration version of the library
  458.           it will be found in the .ARC file).
  459.  
  460.  
  461.           Installing SoftC on Your System          Installing SoftC on Your System
  462.  
  463.           The Source  Code disk  is compatible  with all  of the  compilers
  464.           which I  support. The  Library disk,  however, will  differ  from
  465.           compiler to  compiler. Check the label to be certain you have the
  466.           proper library disk for your compiler.
  467.  
  468.  
  469.           Because the  library disk  is supplied for your compiler, you can
  470.           get started  right away. The source can be recompiled if you ever
  471.           change compilers. It is a good idea to recompile the library when
  472.           you upgrade your compiler.
  473.  
  474.  
  475.           Many compiler  manufacturers suggest a certain directory setup to
  476.           enable the  compiler to  find the  header,  object,  and  library
  477.           files. Rather  than trying  to explain  the various manufacturers
  478.           suggested  directory  setups,  I  will  explain  what  files  are
  479.           required and where they are often located.
  480.  
  481.  
  482.           The SoftC  header files need to be placed where they can be found
  483.           by your  compiler. In  many cases  this is in a special "INCLUDE"
  484.           directory. Other  times they are placed where your source code is
  485.           found. I would suggest that they be placed where the header files
  486.           for your compiler are located. All the header files will be found
  487.           on the source code diskette.
  488.  
  489.  
  490.           Your linker  will need  to be  able  to  find  the  SoftC  object
  491.           libraries. It  is suggested  that these  be placed where the run-
  492.           time libraries for your compiler are found.
  493.  
  494.  
  495.                                            Chapter 2, Before You Begin    5                                                                          5
  496.  
  497.  
  498.           Different libraries  are supplied  for the  various memory models
  499.           your compiler  supports. The  name of  the  library  defines  the
  500.           compiler manufacturer and version, and the memory model for which
  501.           it was  compiled. All library names begin with "SC". The next few
  502.           characters specify  the compiler manufacturer. The last character
  503.           defines the memory model.
  504.  
  505.  
  506.           For example  SCTC20S.LIB is  the small  memory model  library for
  507.           Borland's Turbo C compiler (version 2.x).
  508.  
  509.  
  510.           You may  copy only the libraries for the memory model(s) you plan
  511.           to use. But then again, if you have the space available you could
  512.           copy them all just to have them available.
  513.  
  514.  
  515.           SoftC Applications          SoftC Applications
  516.  
  517.           A typical application skeleton has the following form:
  518.  
  519.  
  520.  
  521.           #include <softc.h>
  522.           #include <windows.h>
  523.           
  524.           /* global declarations */
  525.           
  526.           void main()
  527.           {
  528.             /* local declarations */
  529.           
  530.             scinit(20,20);
  531.             .
  532.             .
  533.             .
  534.             /* body of application */
  535.             .
  536.             .
  537.             .
  538.             scterm();
  539.           }
  540.  
  541.  
  542.  
  543.  
  544.  
  545.           The scinit  function must  be the  first function  called in your              scinit                                                       
  546.           application and  IT MUST  BE CALLED  ONLY ONCE. The last function                           IT MUST  BE CALLED  ONLY ONCE                   
  547.           should be  scterm. This  is not  a requirement  but  it  is  good                     scterm                                                
  548.           programming practice.  This function  should be called only once.
  549.           See the  descriptions of these functions in the library reference
  550.           section of this manual.
  551.  
  552.  
  553.           6    Chapter 2, Before You Begin          6                               
  554.  
  555.  
  556.           Compiling with Turbo C          Compiling with Turbo C
  557.  
  558.           Turbo C  provides two  ways of compiling programs: the integrated
  559.           environment and  the command  line version. In order to use SoftC
  560.           with the  integrated environment  a project  file must be created
  561.           and the appropriate library must be specified in that file:
  562.  
  563.  
  564.           myprog              /* your program name */
  565.           sctc20s.lib         /* the desired SoftC library */
  566.  
  567.  
  568.           To use  the library with the command line compiler simply include
  569.           the library name in filename list:
  570.  
  571.  
  572.           tcc -f -Ic:\c\include -Lc:\c\lib myprog sctc20s.lib
  573.  
  574.  
  575.           Recompiling the SoftC Libraries          Recompiling the SoftC Libraries
  576.  
  577.           If you  modify a SoftC source code file, then that module and any
  578.           related modules  (if any)  must be recompiled and replaced in the
  579.           libraries. The  library source  code is  compiled just  like  any
  580.           other SoftC  program. Refer  to your  compiler documentation  for
  581.           instructions for replacing modules in libraries.
  582.  
  583.  
  584.           Function Naming Conventions          Function Naming Conventions
  585.  
  586.           All SoftC  functions begin  with the  letters "sc".  This  is  to
  587.           differentiate them  from  the  standard  library  functions.  The
  588.           window functions  begin with  "scw",  the  dBase  III  data  file
  589.           functions with  "scd", the  dBase III  index file  functions with
  590.           "sci", and the clock/calendar functions with "scc".
  591.  
  592.  
  593.           
  594.  
  595.  
  596.           Chapter 3          Chapter 3
  597.  
  598.  
  599.           A Windows Toolkit Tutorial          A Windows Toolkit Tutorial
  600.  
  601.  
  602.  
  603.  
  604.           Screen I/O  is a major part of almost every computer application.
  605.           Because of  the limited  amount of  space on the screen it is not
  606.           unusual to  run out  of room. Windowing is one way of coping with
  607.           this limitation,  but perhaps  more importantly  it  enables  the
  608.           programmer to  organize  and  present  information  in  a  useful
  609.           manner.
  610.  
  611.  
  612.           If the  concept of  windows is  new to you, think of your desktop
  613.           covered by  pages of paper. Some pages overlap at the edges, some
  614.           are completely hidden by other pages. This is the same thing that
  615.           happens on  your computer screen. Ordinarily the entire screen is
  616.           devoted to  one page  of information.  Using windows you can have
  617.           parts of many pages visible on your screen at once.
  618.  
  619.  
  620.           You can  open and  overlay as  many windows as the memory of your
  621.           computer will  allow. When  you are finished with a window, close
  622.           it and the underlying information is restored.
  623.  
  624.  
  625.           Because each  window is  treated as  a small  screen, all  of the
  626.           window I/O  functions will  work the  same whether windows are in
  627.           use or  not. In  other words, there is no difference in functions
  628.           (or syntax) to print to the physical screen or to a window.
  629.  
  630.  
  631.           Basic Rules          Basic Rules
  632.  
  633.           In order to benefit fully from the SoftC library, it is necessary
  634.           to use  only the  functions  found  in  the  SoftC  library  when
  635.           performing screen I/O. When standard functions such as printf and                                                                 printf    
  636.           puts are  used, the  SoftC window manager is bypassed. This means          puts                                                             
  637.           that it can no longer keep track of the activities in your window
  638.           which can lead to unpredictable results.
  639.  
  640.  
  641.           SoftC has  direct replacements  for many of the standard C screen
  642.           I/O functions  (the following functions will work with or without
  643.           a window):
  644.  
  645.  
  646.           Standard C                                   SoftC
  647.           printf, cprintf                              scwprintf          printf  cprintf                              scwprintf
  648.           puts, cputs                                  scwputs          puts  cputs                                  scwputs
  649.           putch, putchar                               scwputc          putch  putchar                               scwputc
  650.  
  651.  
  652.           8    Chapter 3, A Windows Toolkit Tutorial          8                                         
  653.  
  654.  
  655.           Also additional  functions have  been added to standardize cursor
  656.           control functions  between compilers  (and in  the future between
  657.           text and  graphics modes) (note that the following functions will
  658.           work with or without a window):
  659.  
  660.  
  661.           Turbo C                                      SoftC
  662.           gotoxy                                       scwgoto          gotoxy                                       scwgoto
  663.           wherex                                       scwxloc          wherex                                       scwxloc
  664.           wherey                                       scwyloc          wherey                                       scwyloc
  665.           clrscr                                       scwclr          clrscr                                       scwclr
  666.           clreol                                       scwclreol          clreol                                       scwclreol
  667.           textcolor, textbackground, textattr          scwaput          textcolor  textbackground  textattr          scwaput
  668.           gettextinfo                                  scwinfo, scwaget          gettextinfo                                  scwinfo  scwaget
  669.  
  670.  
  671.           Screen Output          Screen Output
  672.  
  673.           SoftC provides  three  methods  of  outputting  characters  to  a
  674.           window: scwprintf,  scwputs, and scwputc. scwputc and scwputs are                  scwprintf   scwputs      scwputc  scwputc     scwputs    
  675.           implemented as  macros which  call scwprintf. scwprintf functions                                             scwprintf  scwprintf          
  676.           the same  as  the  standard  printf  function:  a  format  string                                       printf                              
  677.           followed by option arguments are passed to the function. One fact
  678.           to be  aware of  is the  string  expansion  limitation  found  in
  679.           scwprintf: the  data to  be displayed  cannot expand  beyond  256          scwprintf                                                        
  680.           characters including  the terminating NULL byte or the stack will
  681.           be corrupted with potentially disastrous results.
  682.  
  683.  
  684.           Cursor Control          Cursor Control
  685.  
  686.           The SoftC  screen is  divided into  rows and  columns.  Rows  are
  687.           numbered vertically  down the  screen and  columns  are  numbered
  688.           horizontally across  the screen.  Coordinates of any point on the
  689.           screen can  be expressed in column numbers and row numbers. SoftC
  690.           uses a  coordinate system  where the  column is  listed first and
  691.           then the  row. The  upper left corner of the window is defined by
  692.           the coordinates (1,1) (also known as the home coordinates).
  693.  
  694.  
  695.           The row  number is  hereafter referred  to as the 'y' coordinate,
  696.           and the column number is referred to as the 'x' coordinate.
  697.  
  698.  
  699.           Three types  of cursor control functions exist in SoftC: move the
  700.           cursor to  a new  location, tell  where the  cursor is  currently
  701.           positioned, and  hide/show cursor.  scwgoto is used to reposition                                              scwgoto                      
  702.           the cursor anywhere on the window. scwxloc and scwyloc return the                                             scwxloc     scwyloc           
  703.           current cursor  'x' and  'y' coordinates respectively. scwcursoff                                                                 scwcursoff
  704.           will hide the cursor and scwcurson will show it again.                                   scwcurson                    
  705.  
  706.  
  707.                                  Chapter 3, A Windows Toolkit Tutorial    9                                                                          9
  708.  
  709.  
  710.           Erase Functions          Erase Functions
  711.  
  712.           When the  entire window  or only  a portion  of a line need to be
  713.           cleared, the functions scwclr and scwclreol are used. scwclr will                                 scwclr     scwclreol           scwclr     
  714.           erase everything  from the  current  window  and  reposition  the
  715.           cursor at  the home  coordinates. scwclreol  will erase  all text                                            scwclreol                      
  716.           from the current cursor position to the right edge of the window.
  717.           The cursor position will not be changed.
  718.  
  719.  
  720.           Character Colors          Character Colors
  721.  
  722.           Text  color,   background  color,  and  blinking  attributes  are
  723.           controlled via  scwaput and  scwaget functions. Currently sixteen                          scwaput      scwaget                             
  724.           colors are  supported: black,  blue, green,  cyan, red,  magenta,
  725.           brown, light  gray, dark  gray, light  blue, light  green,  light
  726.           cyan,  light  red,  light  magenta,  yellow,  and  white.  It  is
  727.           suggested that  you use the SoftC definitions for these colors in
  728.           order to maintain compatibility with other monitors (such as EGA,
  729.           and VGA).
  730.  
  731.  
  732.           Window Control          Window Control
  733.  
  734.           In order  to use  a window it must first be opened. There are two
  735.           window opening functions: scwopen and scwopenx. scwopen is a high                                    scwopen     scwopenx  scwopen          
  736.           level function  which requires  only the upper left corner screen
  737.           coordinates (x  and y)  and the  width and  height of the desired
  738.           window. The window colors and style are defaulted to zero (0) and
  739.           there is  no  title.  See  the  window  color  and  border  style
  740.           discussions later in this chapter.
  741.  
  742.  
  743.           scwopenx extends the high level window open by giving you control          scwopenx                                                         
  744.           over the  window color  and border style, and allows the use of a
  745.           window title.  After  a  window  has  been  opened,  any  of  the
  746.           preceding window  functions (scwputs,  etc.) will work within the                                       scwputs                             
  747.           confines of that window.
  748.  
  749.  
  750.           Multiple windows  can open at the same time. scwselect provides a                                                       scwselect           
  751.           mechanism to  switch between  any of  the non-overlaid windows on
  752.           the screen.  The library does not allow the selection of a window
  753.           which is partially covered by another.
  754.  
  755.  
  756.           When you  are finished  with a  window it can be removed from the
  757.           screen and  the underlying  data restored via a call to scwclose.                                                                  scwclose 
  758.           This function  will also  free up  the memory  allocated for  the
  759.           window being closed.
  760.  
  761.  
  762.           10    Chapter 3, A Windows Toolkit Tutorial          10                                         
  763.  
  764.  
  765.           At some  point you may need some information about a window, such
  766.           as its size, color scheme, border style, or title length. This is
  767.           accomplished by a call to scwinfo.                                    scwinfo 
  768.  
  769.  
  770.           Window Colors          Window Colors
  771.  
  772.           There is a window color scheme array used by SoftC to control the
  773.           colors of the window border, title, and the initial color of text
  774.           printout. The array is large enough to hold color information for
  775.           ten different color schemes. Each element in the array holds text
  776.           color and  background color  information for  each of  the  three
  777.           previously mentioned items.
  778.  
  779.  
  780.           There  are   two  functions   provided  to   access  this   color
  781.           information: scwcget and scwcput. scwcget will retrieve the color                       scwcget     scwcput  scwcget                        
  782.           scheme and scwcput will set it.                     scwcput             
  783.  
  784.  
  785.           Window Border Styles          Window Border Styles
  786.  
  787.           SoftC uses  another array to control the window border style. The
  788.           six characters  used to  make a window are stored in each element
  789.           of the  array:  the  four  corners  of  the  window  as  well  as
  790.           horizontal and  vertical connecting  characters.  This  array  is
  791.           large enough  to hold  four different  border styles.  scwbget is                                                                 scwbget   
  792.           used to  retrieve border  style information  from the  array, and
  793.           scwbput is used to change it.          scwbput                      
  794.  
  795.  
  796.           Window Titles          Window Titles
  797.  
  798.           Control over  the title  of the current window is provided by two
  799.           functions: scwtget  and scwtput.  The title can be easily changed                     scwtget      scwtput                                  
  800.           via a  call to scwtput. The current window title can be retrieved                         scwtput                                           
  801.           through a call to scwtget. If you are uncertain as to the size of                            scwtget                                        
  802.           the title  string a  call to  scwinfo will  tell you how long the                                        scwinfo                            
  803.           string is including the terminating NULL byte.
  804.  
  805.  
  806.           
  807.  
  808.  
  809.           Chapter 4          Chapter 4
  810.  
  811.  
  812.           A dBase III Toolkit Tutorial          A dBase III Toolkit Tutorial
  813.  
  814.  
  815.  
  816.  
  817.           Most applications  need to  do some  file I/O  operations. Your C
  818.           compiler provides  you with  basic functions  to do  general file
  819.           I/O. But  many cases  will arise  when you need to use a database
  820.           within your  application. The SoftC Library provides functions to
  821.           enable you  to integrate  your program  and dBase  III compatible
  822.           data and index files.
  823.  
  824.  
  825.           For those of you who may be unfamiliar with databases, think of a
  826.           filing  cabinet   filled  with   folders  of   invoices   ordered
  827.           alphabetically  by   company  name.   If  we  wish  to  put  this
  828.           information "on  computer" we have two choices for data file I/O:
  829.           a simple sequential file, or a random access file.
  830.  
  831.  
  832.           Sequential Files          Sequential Files
  833.  
  834.           The concept  of using  a sequential file to store invoice data by
  835.           company name is very simple. Just enter the data as it's found in
  836.           the filing  cabinet. To access the information just begin reading
  837.           at the  start of the file and continue until finished. As you can
  838.           see the time required to find a specific record greatly increases
  839.           as more  and more  records are added to the file. Also the act of
  840.           adding information  to the  file  while  trying  to  keep  it  in
  841.           alphabetical order  becomes very  time consuming  due to the fact
  842.           that many records will have to be moved in order to make room for
  843.           the new record.
  844.  
  845.  
  846.           Random Access Files          Random Access Files
  847.  
  848.           By using  random access  techniques it  becomes  much  easier  to
  849.           access any  particular data  record. All  that is required is the
  850.           desired record  number and  you can  seek to  the proper location
  851.           within the  data file. But how do you know which record number to
  852.           use? And  what about  adding records  in the  middle of  the data
  853.           file? dBase uses keys and an indexed lookup system called ISAM to
  854.           solve both of these problems.
  855.  
  856.  
  857.           Keys          Keys
  858.  
  859.           Keys are generally comprised of one or more pieces of information
  860.           (data fields)  found in a data record. In our example the company
  861.           name could  be used as a key. Each key would point to one or more
  862.           records found  in the  data file.  When  many  keys  are  grouped
  863.  
  864.  
  865.           12    Chapter 4, A dBase III Toolkit Tutorial          12                                           
  866.  
  867.  
  868.           together they  form an  index file. dBase uses a technique called
  869.           ISAM to  access the  underlying B-tree  structure  of  its  index
  870.           files.
  871.  
  872.  
  873.           ISAM and B-trees          ISAM and B-trees
  874.  
  875.           The relationship between a key and the data file record number is
  876.           established via  a "key  item". Many  key items  are found  on an
  877.           "index page".  Many index  pages are  combined to  form an "index
  878.           file". The  method used  to navigate  through the  index file  is
  879.           called "Indexed  Sequential Access  Method" or  ISAM. B-tree  (or
  880.           branch tree)  is the underlying structure used in ISAM. Searching
  881.           always begins  at the  top of the tree. Each key item on an index
  882.           page  can  point  to  another  index  page  (this  is  where  the
  883.           "branching" comes  into play).  If a  key item  does not point to
  884.           another index  page it  is referred  to as  a "terminal  node". A
  885.           search is ended when a terminal node is encountered.
  886.  
  887.  
  888.           When a  data record  for a specific key needs to be accessed, The
  889.           first (top)  index page is searched with the desired key text. If
  890.           not at  a terminal  node, a  determination will be made using the
  891.           branch trees as to which index page should next be searched. This
  892.           sequence of  searching and branching is followed until a terminal
  893.           node is  encountered. If  an exact match is found the data record
  894.           number found  in that  key item  can be  used to  access the data
  895.           file.
  896.  
  897.  
  898.           When a key needs to be added to an index file, the above sequence
  899.           of searching  and branching  is again followed until the location
  900.           where the  new key  should be  placed is  found. Because  of  the
  901.           nature of the ISAM file it is much easier and faster to add a key
  902.           to the index page than appearances may indicate. If an index page
  903.           overflows it  will be  split  into  two  pages.  Likewise  if  it
  904.           underflows it will be joined with another index page. This system
  905.           results in a minimal amount of file I/O.
  906.  
  907.  
  908.           The first  question above  has been  obviously answered, but what
  909.           about the second? The answer lies in the fact that because we are
  910.           using an  index file  we no  longer have to keep the data file in
  911.           alphabetical order,  all we  need to  do is append records to the
  912.           end of the data file and add a key to the index file.
  913.  
  914.  
  915.           This ends  the general  discussion of  databases. One note, it is
  916.           good programming  practice to  create keys only from  data fields
  917.           found in  the data  record, this  allows the reconstruction of an
  918.           index file should something catastrophic happen.
  919.  
  920.  
  921.                               Chapter 4, A dBase III Toolkit Tutorial    13                                                                         13
  922.  
  923.  
  924.           Basic Rules          Basic Rules
  925.  
  926.           In order to benefit fully from the SoftC library, it is necessary
  927.           to use  only the  functions found  in the library when performing
  928.           database I/O.  When standard  functions such as fprintf are used,                                                          fprintf          
  929.           the SoftC database manager is bypassed. This means that it can no
  930.           longer keep  track of the activities in your database files which
  931.           can lead to unpredictable results.
  932.  
  933.  
  934.           This is  not to  say that  you cannot use the standard C file I/O
  935.           functions found  in your  compiler's  libraries,  but  their  use
  936.           should be restricted to non-database I/O.
  937.  
  938.  
  939.           Data File Functions          Data File Functions
  940.  
  941.           In order to use a data file it first must be opened. scdopen will                                                               scdopen     
  942.           open any  dBase III or dBase III+ compatible data file. The SoftC
  943.           database manager file handle will be returned. This handle number
  944.           must be used for all I/O with that specific data file.
  945.  
  946.  
  947.           When you  are finished  with a  data file  it is good practice to
  948.           close that  data file  via a call to scdclose. This is true for a                                               scdclose                    
  949.           couple of  reasons: 1)  The data will be safe if your application
  950.           crashes, and  2) computer  memory will  be freed for other use. A
  951.           safety net  is provided  by scterm in that it will close all data                                      scterm                               
  952.           and  index   files  as  well  as  any  windows  open  at  program
  953.           termination.
  954.  
  955.  
  956.           The length  of the data file in bytes can be found using scdsize.                                                                   scdsize 
  957.           The name of the data file associated with a particular handle can
  958.           be retrieved  via a  call to scdinfo. Also a new data file can be                                       scdinfo                             
  959.           created by scdcreate.                     scdcreate 
  960.  
  961.  
  962.           Data Record I/O          Data Record I/O
  963.  
  964.           Having a data file is of little use unless you can manipulate the
  965.           individual records. SoftC provides seven functions to: read/write
  966.           individual records,  delete/recover deleted  records,  manipulate
  967.           I/O buffers, and retrieve information about the record structure.
  968.  
  969.  
  970.           A data  record can  be read from the data file using scdrget. The                                                               scdrget     
  971.           actual data  will be  placed in  a SoftC internal buffer. See the
  972.           discussion on  Data Field  I/O for  more information on accessing
  973.           the individual  fields found in a data record. When a data record
  974.           needs to  be written  to the  file, scdrput  should be used. This                                              scdrput                      
  975.           function is  used both  for the  changing of  a record as well as
  976.           adding new records.
  977.  
  978.  
  979.           14    Chapter 4, A dBase III Toolkit Tutorial          14                                           
  980.  
  981.  
  982.           dBase III  data records  are not physically removed from the data
  983.           file when  they are  deleted. This enables the user to change his
  984.           mind and recover the deleted records for use again. SoftC follows
  985.           this guideline  by providing  the scdrdel function to mark a data                                            scdrdel                        
  986.           record as  deleted, and  the scdrundel  function to  recover  the                                       scdrundel                           
  987.           record (or mark as active).
  988.  
  989.  
  990.           Information about the data record structure can be retrieved by a
  991.           called to  scdrinfo. The  record length,  number of fields in the                     scdrinfo                                              
  992.           data record, and the addresses of the I/O buffers can be obtained
  993.           in this way.
  994.  
  995.  
  996.           Two additional functions are provided which deal exclusively with
  997.           the  internal   SoftC  I/O   buffers:  scdrclear,  and  scdrcopy.                                                 scdrclear        scdrcopy 
  998.           scdrclear is  useful in clearing the output buffer before placing          scdrclear                                                        
  999.           data in the individual fields. The entire data record will be set
  1000.           to spaces (" "). This has the effect on numeric fields of placing
  1001.           nothing in  the field  rather than  zero. scdrcopy  can be useful                                                    scdrcopy               
  1002.           when a  record needs to be updated but the original also needs to
  1003.           be retained.
  1004.  
  1005.  
  1006.           Data Field I/O          Data Field I/O
  1007.  
  1008.           The six  data  field  manipulation  functions  provide  for:  the
  1009.           writing of  data to  a field in the output buffer, the reading of
  1010.           data from  a field  in the  input buffer, the conversion of field
  1011.           names  to   field  numbers,   and  the  retrieval  of  the  field
  1012.           descriptions originally setup with scdcreate.                                             scdcreate 
  1013.  
  1014.  
  1015.           There are  two types  of field  I/O: standard  C types and ASCIIZ
  1016.           string. scdfput  and scdfget  use the  standard C  types below to                  scdfput      scdfget                                     
  1017.           place data  in and  retrieve data  from individual  fields  in  a
  1018.           record. scdfput  attempts to  properly  format  the  data  before                  scdfput                                                  
  1019.           placing it  in the  field. This  means that  the proper number of
  1020.           spaces,  zeros,   and/or  a   decimal  point  will  be  added  as
  1021.           appropriate.
  1022.  
  1023.  
  1024.           C types                  dBase III types
  1025.           char [8]                 date
  1026.           ASCIIZ string            character
  1027.           double                   numeric
  1028.           char                     logical
  1029.  
  1030.  
  1031.           scdfputs and  scdfgets use ASCIIZ strings exclusively. It is left          scdfputs      scdfgets                                           
  1032.           up to  the users  of these  functions to  ensure that the data is
  1033.           properly formatted. Both "scdfput" functions work with the output
  1034.           buffer, and the "scdfget" functions work with the input buffer.
  1035.  
  1036.  
  1037.                               Chapter 4, A dBase III Toolkit Tutorial    15                                                                         15
  1038.  
  1039.  
  1040.           A field name to field number translation function (scdfnam2no) is                                                             scdfnam2no    
  1041.           provided to  isolate your  application from  the structure of the
  1042.           data files.
  1043.  
  1044.  
  1045.           Index File Functions          Index File Functions
  1046.  
  1047.           In order  to use  an index  file it first must be opened. sciopen                                                                    sciopen
  1048.           will open  any dBase III or dBase III+ compatible index file. The
  1049.           index files  created by Clipper are not compatible with dBase III
  1050.           (and thusly  with SoftC).  The SoftC database manager file handle
  1051.           will be  returned. This  handle number  must be  used for all I/O
  1052.           with that specific index file.
  1053.  
  1054.  
  1055.           When you  are finished with an index file, it can be closed via a
  1056.           call to  scdclose. Information  about the  index file such as the                   scdclose                                                
  1057.           file name  and length of the key expression can be retrieved by a
  1058.           call to  sciinfo. A  new index  file can  be created by using the                   sciinfo                                                 
  1059.           function scicreate.                   scicreate 
  1060.  
  1061.  
  1062.           sciexpr can  be used to get the actual index key expression. This          sciexpr                                                          
  1063.           key expression  is generally  a formula  listing the  field names
  1064.           used to make the index key. For example, FIRST_NAME and LAST_NAME
  1065.           are both  fields found  in a  data file, if an index key was made
  1066.           from the  combination of these fields the key expression could be
  1067.           "LAST_NAME + FIRST_NAME".
  1068.  
  1069.  
  1070.           Index Page Functions          Index Page Functions
  1071.  
  1072.           If memory  is available  the SoftC database manager will allocate
  1073.           space for  ten index  pages. In some instances more or less pages
  1074.           may be  needed to  provide  fast  access  to  index  information.
  1075.           scipinfo is  used to  find out how many pages for which space was          scipinfo                                                         
  1076.           allocated. To  change the  number of  pages for  which memory was
  1077.           allocated, scipnum can be used.                     scipnum             
  1078.  
  1079.  
  1080.           Index Key Functions          Index Key Functions
  1081.  
  1082.           Nine functions  have been  provided for  use in:  finding a  key,
  1083.           moving to  the next  or  previous  key,  adding/deleting  a  key,
  1084.           retrieving the  current key,  and building a key. There are three
  1085.           search functions  supported: find  first key (scikfirst), finding                                                        scikfirst          
  1086.           the last  key  (sciklast),  and  searching  for  a  specific  key                          sciklast                                         
  1087.           (scikfind). The  keys found  in this  manner become  the "current           scikfind                                                        
  1088.           key". Wildcards such as "?" and "*" cannot be used.
  1089.  
  1090.  
  1091.           Once a particular key is found it is often desired to get the key
  1092.           following (sciknext)  or the  key preceding  (scikprev) it. These                     sciknext                           scikprev           
  1093.  
  1094.  
  1095.           16    Chapter 4, A dBase III Toolkit Tutorial          16                                           
  1096.  
  1097.  
  1098.           keys, if  found, become  the current  key.  Another  function  is
  1099.           provided to return the current key, scikcur.                                              scikcur 
  1100.  
  1101.  
  1102.           It also  desirable to  be able  to add  and delete  keys from the
  1103.           index file.  scikadd and  scikdel provide  these functions. These                       scikadd      scikdel                                
  1104.           functions also  attempt to  keep the B-tree balanced, so that one
  1105.           branch of the tree will not grow larger than the others.
  1106.  
  1107.  
  1108.           dBaseIII provides  certain functions  which may  be used in a key
  1109.           expression. scikmake will build a key for you using the index key                      scikmake                                             
  1110.           expression and  the contents  of the  current output buffer. This
  1111.           function supports  five of  the more  common dBaseIII  functions:
  1112.           dtoc, left, right, str, and substr.          dtoc  left  right  str      substr 
  1113.  
  1114.  
  1115.           
  1116.  
  1117.  
  1118.           Chapter 5          Chapter 5
  1119.  
  1120.  
  1121.           Clock & Calendar Functions          Clock & Calendar Functions
  1122.  
  1123.  
  1124.  
  1125.  
  1126.           This chapter will describe the clock and date functions available
  1127.           in  the   SoftC  Library.   Currently  only  nine  functions  are
  1128.           implemented and they are all are date manipulators. Note that the
  1129.           date format  is "yyyymmdd"  for all  functions  unless  otherwise
  1130.           specified.
  1131.  
  1132.  
  1133.           Internal to dBaseIII the date fields are formatted as "yyyymmdd".
  1134.           This format  enables the  date field  to be  used properly  as an
  1135.           index key and ensures that the date February 13, 1989 will always
  1136.           be larger  than the  date December  15, 1988. Note that this date
  1137.           format is  not the  one normally used when entering or displaying
  1138.           dates. If  fact dBaseIII  uses the date format "mm/dd/yy" when it
  1139.           displays dates.
  1140.  
  1141.  
  1142.           A function  sccdxlat was created to allow switching between these                      sccdxlat                                             
  1143.           two formats.  An additional format is provided to enable the year
  1144.           section of  the  date  to  more  accurately  represent  the  year
  1145.           entered. This format is "mm/dd/yyyy".
  1146.  
  1147.  
  1148.           Quite often  some calculations  will need to be performed on date
  1149.           strings and two functions are provided for this purpose. sccddiff                                                                   sccddiff
  1150.           calculates the  difference between  two date strings for you, and
  1151.           sccds2n will  convert the  date string into three integers: year,          sccds2n                                                          
  1152.           month, and  day so you can do your own calculations. sccdn2s will                                                               sccdn2s     
  1153.           convert from three integers back to a string.
  1154.  
  1155.  
  1156.           Two functions  are  provided  to  test  for  leap  year.  sccleap                                                                    sccleap
  1157.           requires a  date string and sccleapi uses an integer. To check if                                      sccleapi                             
  1158.           a  given  date  string  is  valid  sccdvalid  can  be  used.  Two                                             sccdvalid                     
  1159.           additional functions  are provided  for displaying  text strings:
  1160.           sccday is  used to  get the  day of  the week string and sccmonth          sccday                                                   sccmonth
  1161.           returns the month string.
  1162.  
  1163.  
  1164.           
  1165.  
  1166.  
  1167.           Chapter 6          Chapter 6
  1168.  
  1169.  
  1170.           Miscellaneous Functions          Miscellaneous Functions
  1171.  
  1172.  
  1173.  
  1174.  
  1175.           This chapter  will describe  the miscellaneous functions found in
  1176.           the SoftC library.
  1177.  
  1178.  
  1179.           scinit sets  up the  SoftC window  and database  managers. Memory          scinit                                                           
  1180.           will be  allocated for  a  variety  of  internal  structures.  As
  1181.           previously mentioned  this function should be called only once at
  1182.           the beginning of your application. scterm is called at the end of                                             scterm                        
  1183.           your application.  It will  close all  windows and database files
  1184.           and free the memory allocated by scinit.                                           scinit 
  1185.  
  1186.  
  1187.           The  scvers  function  has  been  provided  to  retrieve  a  NULL               scvers                                                      
  1188.           terminated character  string containing  the version of the SoftC
  1189.           library you  are currently  using. This  can then  be printed  by
  1190.           scwputs.          scwputs 
  1191.  
  1192.  
  1193.           A global  variable sc_code  will contain  the results of the last                             sc_code                                       
  1194.           SoftC function  call executed.  Errors are  indicated by negative
  1195.           numbers, warnings  by positive  numbers greater  than zero, and a
  1196.           zero  indicates   success.  During   program  debug   it  may  be
  1197.           advantageous to  print  the  text  message  associated  with  the
  1198.           contents of  sc_code. scemsg  will  return  the  address  of  the                       sc_code  scemsg                                     
  1199.           message associated  with the  contents of sc_code, which can then                                                    sc_code                
  1200.           be printed by scwputs.                        scwputs 
  1201.  
  1202.  
  1203.           If you  desire to  clear an error or warning condition either the
  1204.           global variable sc_code can be set to zero or the function sceclr                          sc_code                                    sceclr
  1205.           can be used. It is preferable to use the function rather than the
  1206.           global variable.
  1207.  
  1208.  
  1209.           
  1210.  
  1211.  
  1212.           Chapter 7          Chapter 7
  1213.  
  1214.  
  1215.           The SoftC Library          The SoftC Library
  1216.  
  1217.  
  1218.  
  1219.  
  1220.           This chapter  contains a  detailed description  of  each  of  the
  1221.           functions in the SoftC library.
  1222.  
  1223.  
  1224.           The following  sample function  description explains  how to  use
  1225.           this portion of the SoftC Library Reference Manual.
  1226.  
  1227.  
  1228.           function name          function name          _____________
  1229.  
  1230.  
  1231.  
  1232.  
  1233.           Usage          Usage          _____
  1234.                     function(modifier parameter[,...]);                    function                                                                 _________        
  1235.  
  1236.  
  1237.                     The declaration  syntax for  function, parameter  names                                                 function                                                                             _________       
  1238.                     are  italicized.   The  [,...]   indicates  that  other
  1239.                     parameters and their modifiers may follow.
  1240.  
  1241.  
  1242.           Prototype in          Prototype in          ____________
  1243.                     This lists  the header  files in  which the function is
  1244.                     prototyped.
  1245.  
  1246.  
  1247.           Description          Description          ___________
  1248.                     This describes  what function  does, the  parameters it
  1249.                     takes, and  any  details  you  need  in  order  to  use
  1250.                     function and the related routines listed.
  1251.  
  1252.  
  1253.           See also          See also          ________
  1254.                     Routines related  to function that you may wish to read
  1255.                     about are listed here.
  1256.  
  1257.  
  1258.           Return Value          Return Value          ____________
  1259.                     The value(s)  that function returns (if any) are listed
  1260.                     here. The  return value  will also  be set  in sc_code.                                                                   sc_code 
  1261.                     Unless  otherwise   noted  in   the  specific  function
  1262.                     description, the  function  call  will  be  ignored  if
  1263.                     sc_code contains  an error  (values less  than zero). A                    sc_code                                                
  1264.                     good return  will always  be equal to zero. Any warning
  1265.                     codes are always greater than zero.
  1266.  
  1267.  
  1268.           20    Chapter 7, The SoftC Library          20                                
  1269.  
  1270.  
  1271.           Example          Example          _______
  1272.                     A sample  program listing demonstrating how function is
  1273.                     used.
  1274.  
  1275.  
  1276.                                          Chapter 7, The SoftC Library    21                                                                         21
  1277.  
  1278.  
  1279.           sccday          sccday          ______
  1280.  
  1281.  
  1282.  
  1283.  
  1284.           Usage          Usage          _____
  1285.                     signed short int sccday( signed char day,                                     sccday                                                                           ___ 
  1286.                                              signed char daystr[10] );                                                         ______       
  1287.  
  1288.  
  1289.           Prototype in          Prototype in          ____________
  1290.                     SoftC.h
  1291.  
  1292.  
  1293.           Description          Description          ___________
  1294.                     sccday returns the day of the week string in daystr for                    sccday                                                                                                                  ______    
  1295.                     the day specified by day. day must be in the range of 0                                         ___  ___                          
  1296.                     (Sunday) to  6 (Saturday).  The maximum  length of  the
  1297.                     string returned will be 9 plus the NULL byte.
  1298.  
  1299.  
  1300.           See also          See also          ________
  1301.                     sccmonth                    sccmonth
  1302.  
  1303.  
  1304.           Return Value          Return Value          ____________
  1305.                     SC_SUCCESS     function successful
  1306.                     SC_BADDATE     invalid date
  1307.  
  1308.  
  1309.           Example          Example          _______
  1310.  
  1311.           #include "SoftC.h"
  1312.           
  1313.           void main()
  1314.           {
  1315.             char day[10];
  1316.           
  1317.             scinit(1,1);
  1318.             sccday(0,day);
  1319.             scwputs(day);
  1320.             scterm();
  1321.           }
  1322.  
  1323.  
  1324.           22    Chapter 7, The SoftC Library          22                                
  1325.  
  1326.  
  1327.           sccddiff          sccddiff          ________
  1328.  
  1329.  
  1330.  
  1331.  
  1332.           Usage          Usage          _____
  1333.                     signed short int sccddiff( signed char *date1,                                     sccddiff                                                                                 _____ 
  1334.                                              signed char *date2,                                                          _____ 
  1335.                                              signed long *diff );                                                          ____   
  1336.  
  1337.  
  1338.           Prototype in          Prototype in          ____________
  1339.                     SoftC.h
  1340.  
  1341.  
  1342.           Description          Description          ___________
  1343.                     sccddiff returns  the difference  in days between date1                    sccddiff                                                                                                                     _____
  1344.                     and date2.  The two  date strings  can be in any order,                        _____                                              
  1345.                     but must  be valid   dates of the format "yyyymmdd" (eg
  1346.                     "19890213"). This is the date format used internally by
  1347.                     the SoftC  database manager.  sccdxlat can  be used  to                                                  sccdxlat                 
  1348.                     translate an  existing date string to this format, or a
  1349.                     date string can be built using sccdn2s.                                                   sccdn2s 
  1350.  
  1351.  
  1352.           See also          See also          ________
  1353.                     sccdxlat, sccdn2s, sccdvalid.                    sccdxlat  sccdn2s  sccdvalid 
  1354.  
  1355.  
  1356.           Return Value          Return Value          ____________
  1357.                     SC_SUCCESS     calculation successful
  1358.                     SC_BADDATE     invalid date
  1359.  
  1360.  
  1361.           Example          Example          _______
  1362.  
  1363.           #include "SoftC.h"
  1364.           
  1365.           void main()
  1366.           {
  1367.             signed long d;
  1368.           
  1369.             scinit(1,1);
  1370.             sccddiff("19890213","19881217",&d);
  1371.             scwprintf("%ld",d);
  1372.             scterm();
  1373.           }
  1374.  
  1375.  
  1376.                                          Chapter 7, The SoftC Library    23                                                                         23
  1377.  
  1378.  
  1379.           sccdn2s          sccdn2s          _______
  1380.  
  1381.  
  1382.  
  1383.  
  1384.           Usage          Usage          _____
  1385.                     signed short int sccdn2s( signed int year,                                     sccdn2s                                                                          _____ 
  1386.                                              signed int month,                                                        _____ 
  1387.                                              signed int day,                                                       ____ 
  1388.                                              signed char *string );                                                          ______   
  1389.  
  1390.  
  1391.           Prototype in          Prototype in          ____________
  1392.                     SoftC.h
  1393.  
  1394.  
  1395.           Description          Description          ___________
  1396.                     sccdn2s  converts  three  integer  date  values  (year,                    sccdn2s                                                                                                                      ____ 
  1397.                     month, and  day) into  a character  string (string).  A                    _____       ___                             ______     
  1398.                     check is  made to  verify that  string is  a valid date                                                    ______                 
  1399.                     string before exiting.
  1400.  
  1401.  
  1402.           See also          See also          ________
  1403.                     sccdvalid, sccds2n.                    sccdvalid  sccds2n 
  1404.  
  1405.  
  1406.           Return Value          Return Value          ____________
  1407.                     SC_SUCCESS     conversion successful
  1408.                     SC_BADDATE     invalid date
  1409.  
  1410.  
  1411.           Example          Example          _______
  1412.  
  1413.           #include "SoftC.h"
  1414.           
  1415.           void main()
  1416.           {
  1417.             signed char d[9];
  1418.           
  1419.             scinit(1,1);
  1420.             sccdn2s(1989,2,13,d);
  1421.             scwputs(d);
  1422.             scterm();
  1423.           }
  1424.  
  1425.  
  1426.           24    Chapter 7, The SoftC Library          24                                
  1427.  
  1428.  
  1429.           sccds2n          sccds2n          _______
  1430.  
  1431.  
  1432.  
  1433.  
  1434.           Usage          Usage          _____
  1435.                     signed short int sccds2n( signed char *string,                                     sccds2n                                                                                 ______ 
  1436.                                              signed int *year,                                                       _ ____ 
  1437.                                              signed int *month,                                                         _____ 
  1438.                                              signed int *day );                                                       _ ___   
  1439.  
  1440.  
  1441.           Prototype in          Prototype in          ____________
  1442.                     SoftC.h
  1443.  
  1444.  
  1445.           Description          Description          ___________
  1446.                     sccds2n converts dates from a character string (string)                    sccds2n                                                                                                                    ______ 
  1447.                     to three  integer values  (year,  month,  and  day).  A                                               ____   _____        ___     
  1448.                     partial check  is made to verify that string is a valid                                                          ______           
  1449.                     date string before attempting to convert.
  1450.  
  1451.  
  1452.           See also          See also          ________
  1453.                     sccdn2s.                    sccdn2s 
  1454.  
  1455.  
  1456.           Return Value          Return Value          ____________
  1457.                     SC_SUCCESS     conversion successful
  1458.                     SC_BADDATE     invalid date
  1459.  
  1460.  
  1461.           Example          Example          _______
  1462.  
  1463.           #include "SoftC.h"
  1464.           
  1465.           void main()
  1466.           {
  1467.             signed int y, m, d;
  1468.           
  1469.             scinit(1,1);
  1470.             sccds2n("19890213",&y,&m,&d);
  1471.             scwprintf("%d %d %d",y,m,d);
  1472.             scterm();
  1473.           }
  1474.  
  1475.  
  1476.                                          Chapter 7, The SoftC Library    25                                                                         25
  1477.  
  1478.  
  1479.           sccdvalid          sccdvalid          _________
  1480.  
  1481.  
  1482.  
  1483.  
  1484.           Usage          Usage          _____
  1485.                     signed char sccdvalid( signed char *string );                                sccdvalid                                                                                ______   
  1486.  
  1487.  
  1488.           Prototype in          Prototype in          ____________
  1489.                     SoftC.h
  1490.  
  1491.  
  1492.           Description          Description          ___________
  1493.                     sccdvalid tests  the date  string (string)  passed  for                    sccdvalid                                                                                                     ______              
  1494.                     validity: string properly formatted ("yyyymmdd"), valid
  1495.                     day of month, valid month of year.
  1496.  
  1497.  
  1498.           Return Value          Return Value          ____________
  1499.                     TRUE      valid date
  1500.                     FALSE     invalid date
  1501.  
  1502.  
  1503.           Example          Example          _______
  1504.  
  1505.           #include "SoftC.h"
  1506.           
  1507.           void main()
  1508.           {
  1509.             scinit(1,1);
  1510.             if (sccdvalid("19890213"))
  1511.               scwputs("Good Date.");
  1512.             else
  1513.               scwputs("Bad Date.");
  1514.             scterm();
  1515.           }
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.           sccdxlat          sccdxlat          ________
  1522.  
  1523.  
  1524.  
  1525.  
  1526.           Usage          Usage          _____
  1527.                     signed short int sccdxlat( signed char method,                                     sccdxlat                                                                                ______ 
  1528.                                              signed char *source,                                                          ______ 
  1529.                                              signed char *dest );                                                          ____   
  1530.  
  1531.  
  1532.           26    Chapter 7, The SoftC Library          26                                
  1533.  
  1534.  
  1535.           Prototype in          Prototype in          ____________
  1536.                     SoftC.h
  1537.  
  1538.  
  1539.           Description          Description          ___________
  1540.                     sccdxlat translates  from one  date  string  format  to                    sccdxlat                                               
  1541.                     another  under   control  of  method.  Currently  three                                                  ______                   
  1542.                     translation methods  are supported:  SC_2ASCII  -  from
  1543.                     "yyyymmdd" to  "mm/dd/yy", SC_2ASCIIL - from "yyyymmdd"
  1544.                     to "mm/dd/yyyy", and SC_2DBASE - from "mm/dd/[yy]yy" to
  1545.                     "yyyymmdd".
  1546.  
  1547.  
  1548.                     The  maximum   lengths  of   dest  and  source  are  10                                                 ____       ______         
  1549.                     characters (plus the NULL byte).
  1550.  
  1551.  
  1552.                     Note that when converting using SC_2DBASE dates such as
  1553.                     "2/1/89" will be translated to "19890201".
  1554.  
  1555.  
  1556.           Return Value          Return Value          ____________
  1557.                     SC_SUCCESS     translation successful
  1558.                     SC_BADCMD      invalid translation method                                                       ______
  1559.                     SC_BADDATE     invalid date
  1560.  
  1561.  
  1562.           Example          Example          _______
  1563.  
  1564.           #include "SoftC.h"
  1565.           
  1566.           void main()
  1567.           {
  1568.             char date[11];
  1569.           
  1570.             scinit(1,1);
  1571.             sccdxlat(SC_2ASCII,"2/1/89",date);
  1572.             scwputs(date);
  1573.             scterm();
  1574.           }
  1575.  
  1576.  
  1577.  
  1578.  
  1579.  
  1580.           sccleap          sccleap          _______
  1581.  
  1582.  
  1583.  
  1584.  
  1585.           Usage          Usage          _____
  1586.                     signed char sccleap( signed char *leap );                                sccleap                                                                            ____   
  1587.  
  1588.  
  1589.                                          Chapter 7, The SoftC Library    27                                                                         27
  1590.  
  1591.  
  1592.           Prototype in          Prototype in          ____________
  1593.                     SoftC.h
  1594.  
  1595.  
  1596.           Description          Description          ___________
  1597.                     sccleap tests  the string  year passed to it in leap to                    sccleap                                                                                                                    ____   
  1598.                     see if it is a leap year.
  1599.  
  1600.  
  1601.           See also          See also          ________
  1602.                     sccleapi                    sccleapi
  1603.  
  1604.  
  1605.           Return Value          Return Value          ____________
  1606.                     TRUE           year was a leap year
  1607.                     FALSE          year was not a leap year
  1608.  
  1609.  
  1610.           Example          Example          _______
  1611.  
  1612.           #include "SoftC.h"
  1613.           
  1614.           void main()
  1615.           {
  1616.           
  1617.             scinit(1,1);
  1618.             if (sccleap("1989")
  1619.               scwputs("Leap Year!");
  1620.             else
  1621.               scwputs("Normal Year.");
  1622.             scterm();
  1623.           }
  1624.  
  1625.  
  1626.  
  1627.  
  1628.  
  1629.           sccleapi          sccleapi          ________
  1630.  
  1631.  
  1632.  
  1633.  
  1634.           Usage          Usage          _____
  1635.                     signed char sccleapi( signed int leap );                                sccleapi                                                                         ____   
  1636.  
  1637.  
  1638.           Prototype in          Prototype in          ____________
  1639.                     SoftC.h
  1640.  
  1641.  
  1642.           Description          Description          ___________
  1643.                     sccleapi tests the integer year passed to it in leap to                    sccleapi                                                                                                                   ____   
  1644.                     see if it is a leap year.
  1645.  
  1646.  
  1647.           28    Chapter 7, The SoftC Library          28                                
  1648.  
  1649.  
  1650.           See also          See also          ________
  1651.                     sccleap                    sccleap
  1652.  
  1653.  
  1654.           Return Value          Return Value          ____________
  1655.                     TRUE           year was a leap year
  1656.                     FALSE          year was not a leap year
  1657.  
  1658.  
  1659.           Example          Example          _______
  1660.  
  1661.           #include "SoftC.h"
  1662.           
  1663.           void main()
  1664.           {
  1665.           
  1666.             scinit(1,1);
  1667.             if (sccleap(1989)
  1668.               scwputs("Leap Year!");
  1669.             else
  1670.               scwputs("Normal Year.");
  1671.             scterm();
  1672.           }
  1673.  
  1674.  
  1675.  
  1676.  
  1677.  
  1678.           sccmonth          sccmonth          ________
  1679.  
  1680.  
  1681.  
  1682.  
  1683.           Usage          Usage          _____
  1684.                     signed short int sccmonth( signed char month,                                     sccmonth                                                                               _____ 
  1685.                                              signed char monthstr[10] );                                                         ________       
  1686.  
  1687.  
  1688.           Prototype in          Prototype in          ____________
  1689.                     SoftC.h
  1690.  
  1691.  
  1692.           Description          Description          ___________
  1693.                     sccmonth returns  the month  string in monthstr for the                    sccmonth                                                                                                          ________        
  1694.                     month specified by month. month must be in the range of                                       _____  _____                        
  1695.                     1 (January) to 12 (December). The maximum length of the
  1696.                     string returned will be 9 plus the NULL byte.
  1697.  
  1698.  
  1699.           See also          See also          ________
  1700.                     sccday                    sccday
  1701.  
  1702.  
  1703.                                          Chapter 7, The SoftC Library    29                                                                         29
  1704.  
  1705.  
  1706.           Return Value          Return Value          ____________
  1707.                     SC_SUCCESS     function successful
  1708.                     SC_BADDATE     invalid date
  1709.  
  1710.  
  1711.           Example          Example          _______
  1712.  
  1713.           #include "SoftC.h"
  1714.           
  1715.           void main()
  1716.           {
  1717.             char month[10];
  1718.           
  1719.             scinit(1,1);
  1720.             sccmonth(0,month);
  1721.             scwputs(month);
  1722.             scterm();
  1723.           }
  1724.  
  1725.  
  1726.  
  1727.  
  1728.  
  1729.           scdclose          scdclose          ________
  1730.  
  1731.  
  1732.  
  1733.  
  1734.           Usage          Usage          _____
  1735.                     signed short int scdclose( signed char handle );                                     scdclose                                                                                  ______   
  1736.  
  1737.  
  1738.           Prototype in          Prototype in          ____________
  1739.                     dbase.h
  1740.  
  1741.  
  1742.           Description          Description          ___________
  1743.                     scdclose closes  a .DBF  file and  frees all  allocated                    scdclose                                               
  1744.                     memory associated with .DBF file handle.
  1745.  
  1746.  
  1747.           See also          See also          ________
  1748.                     scdopen                    scdopen
  1749.  
  1750.  
  1751.           Return Value          Return Value          ____________
  1752.                     SC_SUCCESS     .DBF file closed
  1753.                     SC_CLOSFAIL    file close failure
  1754.                     SC_BADHNDL     .DBF file not open or bad handle
  1755.  
  1756.  
  1757.           30    Chapter 7, The SoftC Library          30                                
  1758.  
  1759.  
  1760.           Example          Example          _______
  1761.  
  1762.           #include "SoftC.h"
  1763.           #include "dbase.h"
  1764.           
  1765.           void main()
  1766.           {
  1767.             char dbf;
  1768.           
  1769.             scinit(20,20);
  1770.             if (scdopen(&dbf,"TEST.DBF") == SC_SUCCESS)
  1771.               scdclose(dbf);
  1772.             scterm();
  1773.           }
  1774.  
  1775.  
  1776.  
  1777.  
  1778.  
  1779.           scdcreate          scdcreate          _________
  1780.  
  1781.  
  1782.  
  1783.  
  1784.           Usage          Usage          _____
  1785.                     signed short int scdcreate( signed char *filename,                                     scdcreate                                                                                     ________ 
  1786.                                                 signed char numfields,                                                            _________ 
  1787.                                                 SC_FIELD fields[]);                                                         ______    
  1788.  
  1789.  
  1790.           Prototype in          Prototype in          ____________
  1791.                     dbase.h
  1792.  
  1793.  
  1794.           Description          Description          ___________
  1795.                     scdcreate creates a .DBF file. A pointer to an array of                    scdcreate                                              
  1796.                     SC_FIELD must be passed.
  1797.  
  1798.  
  1799.                     typedef struct {
  1800.                       signed char name[11];  /* field name */
  1801.                       signed char type;      /* field type */
  1802.                       unsigned char len;     /* field length */
  1803.                       unsigned char decpl;   /* decimal places */
  1804.                     } SC_FIELD;                      SC_FIELD 
  1805.  
  1806.  
  1807.                     The field  description array  must be  initialized  and
  1808.                     each element  set  to  appropriate  values.  The  array
  1809.                     determines the  organization of a data record. The .DBF
  1810.                     file does not remain open upon exit of this function.
  1811.  
  1812.  
  1813.                                          Chapter 7, The SoftC Library    31                                                                         31
  1814.  
  1815.  
  1816.                     This function  will create  a new .DBF file even if one
  1817.                     had already existed.
  1818.  
  1819.  
  1820.                     Field names  and types  are converted to all upper case
  1821.                     when the file is created.
  1822.  
  1823.  
  1824.                     Restrictions:  DBaseIII:
  1825.                     maximum record length is 4000 bytes.
  1826.                     maximum number of fields is 128.
  1827.                     maximum length of character fields is 254.
  1828.                     
  1829.                                    SoftC:
  1830.                     maximum length of numeric fields is 19 this includes
  1831.                     the decimal point and the sign .
  1832.                     length of date field is forced to 8.
  1833.                     length of logical fields is forced to 1.
  1834.                     the decimal places will be forced to zero for all types
  1835.                     except NUMERIC in which case it must be less then 'len'
  1836.                     - 2.
  1837.  
  1838.  
  1839.           Return Value          Return Value          ____________
  1840.                     SC_SUCCESS     .DBF file created
  1841.                     SC_WRTFAIL     disk write failure
  1842.                     SC_BADFLD      user supplied field description bad
  1843.                     SC_NOHNDL      no DOS file handles available
  1844.  
  1845.  
  1846.           Example          Example          _______
  1847.  
  1848.           #include "SoftC.h"
  1849.           #include "dbase.h"
  1850.           
  1851.           void main()
  1852.           {
  1853.             SC_FIELD fields[4] = {
  1854.               "character",'c',16,0,     /* character field */
  1855.               "date",'d',8,0,           /* date field */
  1856.               "logical",'l',1,0,        /* logical field */
  1857.               "numeric",'n',6,2         /* numeric field */
  1858.             };
  1859.           
  1860.             scinit(20,20);
  1861.             scdcreate("TEST.DBF",4,fields);
  1862.             scterm();
  1863.           }
  1864.  
  1865.  
  1866.           32    Chapter 7, The SoftC Library          32                                
  1867.  
  1868.  
  1869.           scdfget          scdfget          _______
  1870.  
  1871.  
  1872.  
  1873.  
  1874.           Usage          Usage          _____
  1875.                     signed short int scdfget( signed char handle,                                     scdfget                                                                               ______ 
  1876.                                               signed char fieldno,                                                          _______ 
  1877.                                               void *data );                                                    ____   
  1878.  
  1879.  
  1880.           Prototype in          Prototype in          ____________
  1881.                     dbase.h
  1882.  
  1883.  
  1884.           Description          Description          ___________
  1885.                     scdfget gets  data from  the desired field (fieldno) of                    scdfget                                                                                                                _______    
  1886.                     the input  buffer. data will be converted from DBaseIII
  1887.                     to a more natural data type for 'c':
  1888.  
  1889.  
  1890.                     DBaseIII field type      returned data type
  1891.                          'C'                      signed char *
  1892.                          'D'                      signed char [9]
  1893.                          'L'                      signed char
  1894.                          'N'                      double
  1895.  
  1896.  
  1897.                     scdfinfo can  be used  to determine  the length  of the                    scdfinfo                                               
  1898.                     longest data field in the file.
  1899.  
  1900.  
  1901.                     Note that  date fields  are returned as NULL terminated
  1902.                     character  strings   in  the   form:  "mm/dd/yy",   and
  1903.                     character  fields   are  returned  as  NULL  terminated
  1904.                     character strings.
  1905.  
  1906.  
  1907.           See also          See also          ________
  1908.                     scdfgets,  scdfput, scdfinfo, scdrget.                    scdfgets   scdfput  scdfinfo  scdrget 
  1909.  
  1910.  
  1911.           Return Value          Return Value          ____________
  1912.                     SC_SUCCESS     retrieved data from field
  1913.                     SC_BADHNDL     .DBF file not open or bad handle
  1914.                     SC_BADFLD      invalid data record field number
  1915.  
  1916.  
  1917.           Example          Example          _______
  1918.  
  1919.           #include "SoftC.h"
  1920.           #include "dbase.h"
  1921.           #include "windows.h"
  1922.           
  1923.  
  1924.  
  1925.                                          Chapter 7, The SoftC Library    33                                                                         33
  1926.  
  1927.  
  1928.           void main()
  1929.           {
  1930.             char dbf, character[17],logical,date[9];
  1931.             double numeric;
  1932.           
  1933.             scinit(20,20);
  1934.             if (scdopen(&dbf,"TEST.DBF") == SC_SUCCESS) {
  1935.               scdrget(dbf,1L);
  1936.               scdfgets(dbf,0,character);
  1937.               scdfget(dbf,1,(void *) date);
  1938.               scdfget(dbf,2,(void *) &logical);
  1939.               scdfget(dbf,3,(void *) &numeric);
  1940.               scwprintf("%s %s %c %lf\n",
  1941.                 character,date,logical,numeric);
  1942.               scdclose(dbf);
  1943.             }
  1944.             scterm();
  1945.           }
  1946.  
  1947.  
  1948.  
  1949.  
  1950.  
  1951.           scdfgets          scdfgets          ________
  1952.  
  1953.  
  1954.  
  1955.  
  1956.           Usage          Usage          _____
  1957.                     signed short int scdfgets( signed char handle,                                     scdfgets                                                                                _______
  1958.                                                signed char fieldno,                                                           _______ 
  1959.                                                char *data );                                                     ____   
  1960.  
  1961.  
  1962.           Prototype in          Prototype in          ____________
  1963.                     dbase.h
  1964.  
  1965.  
  1966.           Description          Description          ___________
  1967.                     scdfgets gets  data from the desired field (fieldno) of                    scdfgets                                                                                                               _______    
  1968.                     the input  buffer. data  will be  returned as an ASCIIZ                                       ____                                
  1969.                     string.
  1970.  
  1971.  
  1972.                     scdfinfo can  be used  to determine  the length  of the                    scdfinfo                                               
  1973.                     longest data field in the file.
  1974.  
  1975.  
  1976.                     Note  that   date  fields  are  returned  in  the  form
  1977.                     "yyyymmdd". There  is a  difference  between  the  date
  1978.                     formats of scdfgets and scdfget.                               scdfgets     scdfget 
  1979.  
  1980.  
  1981.           34    Chapter 7, The SoftC Library          34                                
  1982.  
  1983.  
  1984.           See also          See also          ________
  1985.                     scdfget,  scdfputs, scdfinfo, scdrget.                    scdfget   scdfputs  scdfinfo  scdrget 
  1986.  
  1987.  
  1988.           Return Value          Return Value          ____________
  1989.                     SC_SUCCESS     retrieved data from field
  1990.                     SC_BADHNDL     .DBF file not open or bad handle
  1991.                     SC_BADFLD      invalid data record field number
  1992.  
  1993.  
  1994.           Example          Example          _______
  1995.  
  1996.           #include "SoftC.h"
  1997.           #include "dbase.h"
  1998.           #include "windows.h"
  1999.           
  2000.           void main()
  2001.           {
  2002.             char dbf, character[17] = "Hello",
  2003.                  logical = 'F', date[9] = "12/25/88";
  2004.             double numeric = 150.00L;
  2005.           
  2006.             scinit(20,20);
  2007.             if (scdopen(&dbf,"TEST.DBF") == SC_SUCCESS) {
  2008.               scdrget(dbf,1L);
  2009.               scdfgets(dbf,0,character);
  2010.               scdfgets(dbf,1,date);
  2011.               scdfget(dbf,2,(void *) &logical);
  2012.               scdfget(dbf,3,(void *) &numeric);
  2013.               scwprintf("%s %s %c %lf\n",
  2014.                 character,date,logical,numeric);
  2015.               scdclose(dbf);
  2016.             }
  2017.             scterm();
  2018.           }
  2019.  
  2020.  
  2021.  
  2022.  
  2023.  
  2024.           scdfinfo          scdfinfo          ________
  2025.  
  2026.  
  2027.  
  2028.  
  2029.           Usage          Usage          _____
  2030.                     signed short int scdfinfo( signed char handle,                                     scdfinfo                                                                                ______ 
  2031.                                                signed char *longfldlen,                                                            __________ 
  2032.                                                SC_FIELD *fields );                                                         ______   
  2033.  
  2034.  
  2035.           Prototype in          Prototype in          ____________
  2036.                     dbase.h
  2037.  
  2038.  
  2039.                                          Chapter 7, The SoftC Library    35                                                                         35
  2040.  
  2041.  
  2042.           Description          Description          ___________
  2043.                     scdfinfo copies  the .DBF  field descriptions to fields                    scdfinfo                                                                                                                    ______
  2044.                     using the structure SC_FIELD. The length of the longest                                        SC_FIELD                           
  2045.                     data field is also returned (longfldlen).                                                 __________  
  2046.  
  2047.  
  2048.                     typedef struct {
  2049.                       signed char name[11];  /* field name */
  2050.                       signed char type;      /* field type */
  2051.                       unsigned char len;     /* field length */
  2052.                       unsigned char decpl;   /* decimal places */
  2053.                     } SC_FIELD;                      SC_FIELD 
  2054.  
  2055.  
  2056.                     The user  must ensure that the array defined for fields
  2057.                     is large  enough to  hold all of the field descriptions
  2058.                     because scdfinfo  blindly copies  the  descriptions  to                            scdfinfo                                       
  2059.                     fields. Severe  program errors can be the result if the
  2060.                     field array is too small. Use scdrinfo to determine the                                                  scdrinfo                 
  2061.                     number of fields in the data record.
  2062.  
  2063.  
  2064.           See also          See also          ________
  2065.                     scdrinfo                    scdrinfo
  2066.  
  2067.  
  2068.           Return Value          Return Value          ____________
  2069.                     SC_SUCCESS     returned the field descriptions
  2070.                     SC_BADHNDL     .DBF file not open or bad handle
  2071.  
  2072.  
  2073.           Example          Example          _______
  2074.  
  2075.           #include "SoftC.h"
  2076.           #include "dbase.h"
  2077.           #include "windows.h"
  2078.           
  2079.           void main()
  2080.           {
  2081.             char dbf, longfld, numflds, a;
  2082.             SC_FIELD fields[128];  /* dBaseIII max size */
  2083.             short reclen;
  2084.             void *ibfr, *obfr;
  2085.           
  2086.             scinit(20,20);
  2087.             if (scdopen(&dbf,"TEST.DBF") == SC_SUCCESS) {
  2088.               scdrinfo(dbf,&reclen,&numflds,&ibfr,&obfr);
  2089.               scdfinfo(dbf,&longfld,fields);
  2090.               scwprintf("longest field length = %d\n",longfld);
  2091.               for (a = 0; a < numflds; a++)
  2092.                 scwprintf("%s %c %d %d\n", fields[a].name, fields[a].type,
  2093.                     fields[a].len, fields[a].decpl);
  2094.               scdclose(dbf);
  2095.             }
  2096.  
  2097.  
  2098.           36    Chapter 7, The SoftC Library          36                                
  2099.  
  2100.  
  2101.             scterm();
  2102.           }
  2103.  
  2104.  
  2105.  
  2106.  
  2107.  
  2108.           scdfnam2no          scdfnam2no          __________
  2109.  
  2110.  
  2111.  
  2112.  
  2113.           Usage          Usage          _____
  2114.                     signed short int scdfnam2no( signed char handle,                                     scdfnam2no                                                                                  ______ 
  2115.                                                  signed char *fieldname,                                                              _________ 
  2116.                                                  signed char *fieldno );                                                              _______   
  2117.  
  2118.  
  2119.           Prototype in          Prototype in          ____________
  2120.                     dbase.h
  2121.  
  2122.  
  2123.           Description          Description          ___________
  2124.                     scdfnam2no searches through the field description array                    scdfnam2no                                             
  2125.                     for .DBF  file handle  looking for  fieldname. It  will                                                        _________          
  2126.                     return the corresponding field number.
  2127.  
  2128.  
  2129.                     Note that  .DBF files  created by SoftC will have field
  2130.                     names changed to all upper case.
  2131.  
  2132.  
  2133.           Return Value          Return Value          ____________
  2134.                     SC_SUCCESS     field number returned
  2135.                     SC_BADHNDL     .DBF file not open or bad handle
  2136.                     SC_BADFLD      invalid data record field name
  2137.  
  2138.  
  2139.           Example          Example          _______
  2140.  
  2141.           #include "SoftC.h"
  2142.           #include "dbase.h"
  2143.           #include "windows.h"
  2144.           
  2145.           void main()
  2146.           {
  2147.             char dbf, fldno
  2148.           
  2149.             scinit(20,20);
  2150.             if (scdopen(&dbf,"TEST.DBF") == SC_SUCCESS) {
  2151.               scdfnam2no(dbf,"LOGICAL",&fldno);
  2152.               scwprintf("%d",fldno);
  2153.               scdclose(dbf);
  2154.             }
  2155.  
  2156.  
  2157.                                          Chapter 7, The SoftC Library    37                                                                         37
  2158.  
  2159.  
  2160.             scterm();
  2161.           }
  2162.  
  2163.  
  2164.  
  2165.  
  2166.  
  2167.           scdfput          scdfput          _______
  2168.  
  2169.  
  2170.  
  2171.  
  2172.           Usage          Usage          _____
  2173.                     signed short int scdfput( signed char handle,                                     scdfput                                                                               ______ 
  2174.                                               signed char fieldno,                                                          _______ 
  2175.                                               void *data );                                                    ____   
  2176.  
  2177.  
  2178.           Prototype in          Prototype in          ____________
  2179.                     dbase.h
  2180.  
  2181.  
  2182.           Description          Description          ___________
  2183.                     scdfput will  convert data  from 'c' format to dBaseIII                    scdfput                                                                                          ____                             
  2184.                     format and  place it  in the  proper field (fieldno) of                                                                _______    
  2185.                     the output buffer.
  2186.  
  2187.  
  2188.                     Field numbers  begin with  zero (0).  If the  field  is
  2189.                     numeric, data should be passed as a double.                             ____                              
  2190.  
  2191.  
  2192.                     Note that  scdfput follows the date formatting standard                               scdfput                                     
  2193.                     of scdfget.  It is  optional to  include the  "19" from                       scdfget                                             
  2194.                     "1989" as  this is  assumed, however  the date "2/1/00"
  2195.                     will become  "19000201" even  if you had intended it to
  2196.                     be  "20000201".   Date  strings  can  be  formatted  as
  2197.                     "2/1/2000" to overcome this problem.
  2198.  
  2199.  
  2200.           See also          See also          ________
  2201.                     scdfget, scdfputs.                    scdfget  scdfputs 
  2202.  
  2203.  
  2204.           Return Value          Return Value          ____________
  2205.                     SC_SUCCESS     data placed in field
  2206.                     SC_BADHNDL     .DBF file not open or bad handle
  2207.                     SC_BADFLD      invalid data record field number
  2208.  
  2209.  
  2210.           Example          Example          _______
  2211.  
  2212.           #include "SoftC.h"
  2213.           #include "dbase.h"
  2214.  
  2215.  
  2216.           38    Chapter 7, The SoftC Library          38                                
  2217.  
  2218.  
  2219.           #include "windows.h"
  2220.           
  2221.           void main()
  2222.           {
  2223.             char dbf, logical = 'T', date[9] = "12/25/88";
  2224.             long recno;
  2225.             double numeric = 20.0L;
  2226.           
  2227.             scinit(20,20);
  2228.             if (scdopen(&dbf,"TEST.DBF") == SC_SUCCESS) {
  2229.               scdfputs(dbf,0,"SoftC Library   ");
  2230.               scdfput(dbf,1,(void *) date);
  2231.               scdfput(dbf,2,(void *) &logical);
  2232.               scdfput(dbf,3,(void *) &numeric);
  2233.               scdrput(dbf,SC_ADD,&recno);
  2234.               scwprintf("Record number = %ld\n",recno);
  2235.               scdclose(dbf);
  2236.             }
  2237.             scterm();
  2238.           }
  2239.  
  2240.  
  2241.  
  2242.  
  2243.  
  2244.           scdfputs          scdfputs          ________
  2245.  
  2246.  
  2247.  
  2248.  
  2249.           Usage          Usage          _____
  2250.                     signed short int scdfputs( signed char handle,                                     scdfputs                                                                                ______ 
  2251.                                               signed char fieldno,                                                          _______ 
  2252.                                               char *data );                                                    ____   
  2253.  
  2254.  
  2255.           Prototype in          Prototype in          ____________
  2256.                     dbase.h
  2257.  
  2258.  
  2259.           Description          Description          ___________
  2260.                     scdfputs will  place data in the proper field (fieldno)                    scdfputs                                                                                        ____                      _______ 
  2261.                     of the  output buffer.  It is the user's responsibility
  2262.                     to provide a properly sized and formatted ASCIIZ string
  2263.                     to scdfputs.                       scdfputs 
  2264.  
  2265.  
  2266.                     Field numbers  begin with  zero (0).  If the  field  is
  2267.                     numeric, data should be passed as a double.                             ____                              
  2268.  
  2269.  
  2270.                     Note  that   scdfputs  follows   the  date   formatting                                 scdfputs                                  
  2271.                     conventions of  scdfgets. Also  be aware  that the date                                    scdfgets                               
  2272.  
  2273.  
  2274.                                          Chapter 7, The SoftC Library    39                                                                         39
  2275.  
  2276.  
  2277.                     formatting conventions  of scdfget/scdfput  are not the                                               scdfget scdfput             
  2278.                     same as scdfgets/scdfputs.                            scdfgets scdfputs 
  2279.  
  2280.  
  2281.           See also          See also          ________
  2282.                     scdfgets, scdfput.                    scdfgets  scdfput 
  2283.  
  2284.  
  2285.           Return Value          Return Value          ____________
  2286.                     SC_SUCCESS     data placed in field
  2287.                     SC_BADHNDL     .DBF file not open or bad handle
  2288.                     SC_BADFLD      invalid data record field number
  2289.  
  2290.  
  2291.           Example          Example          _______
  2292.  
  2293.           #include "SoftC.h"
  2294.           #include "dbase.h"
  2295.           #include "windows.h"
  2296.           
  2297.           void main()
  2298.           {
  2299.             char dbf, logical,date[9];
  2300.             long recno;
  2301.             double numeric;
  2302.           
  2303.             scinit(20,20);
  2304.             if (scdopen(&dbf,"TEST.DBF") == SC_SUCCESS) {
  2305.               scdfputs(dbf,0,"SoftC Library   ");
  2306.               scdfputs(dbf,1, date);
  2307.               scdfput(dbf,2,(void *) &logical);
  2308.               scdfput(dbf,3,(void *) &numeric);
  2309.               scdrput(dbf,SC_ADD,&recno);
  2310.               scwprintf("Record number = %ld\n",recno);
  2311.               scdclose(dbf);
  2312.             }
  2313.             scterm();
  2314.           }
  2315.  
  2316.  
  2317.  
  2318.  
  2319.  
  2320.           scdinfo          scdinfo          _______
  2321.  
  2322.  
  2323.  
  2324.  
  2325.           Usage          Usage          _____
  2326.                     signed short int scdinfo( signed char handle,                                     scdinfo                                                                               ______ 
  2327.                                               signed char *filename );                                                           ________   
  2328.  
  2329.  
  2330.           40    Chapter 7, The SoftC Library          40                                
  2331.  
  2332.  
  2333.           Prototype in          Prototype in          ____________
  2334.                     dbase.h
  2335.  
  2336.  
  2337.           Description          Description          ___________
  2338.                     scdinfo gets  the name  of  the  file  associated  with                    scdinfo                                                
  2339.                     handle.                    ______ 
  2340.  
  2341.  
  2342.           See also          See also          ________
  2343.                     scdopen                    scdopen
  2344.  
  2345.  
  2346.           Return Value          Return Value          ____________
  2347.                     SC_SUCCESS     returned the file name
  2348.                     SC_BADHNDL     .DBF file not open or bad handle
  2349.  
  2350.  
  2351.           Example          Example          _______
  2352.  
  2353.           #include <dir.h>
  2354.           #include "SoftC.h"
  2355.           #include "dbase.h"
  2356.           #include "windows.h"
  2357.           
  2358.           void main()
  2359.           {
  2360.             char dbf;
  2361.             char filename[MAXPATH];
  2362.           
  2363.             scinit(20,20);
  2364.             if (scdopen(&dbf,"TEST.DBF") == SC_SUCCESS) {
  2365.               scdinfo(dbf,filename);
  2366.               scwprintf("%s",filename);
  2367.               scdclose(dbf);
  2368.             }
  2369.             scterm();
  2370.           }
  2371.  
  2372.  
  2373.  
  2374.  
  2375.  
  2376.           scdopen          scdopen          _______
  2377.  
  2378.  
  2379.  
  2380.  
  2381.           Usage          Usage          _____
  2382.                     signed short int scdopen( signed char *handle,                                     scdopen                                                                                 ______ 
  2383.                                               signed char *filename );                                                           ________   
  2384.  
  2385.  
  2386.                                          Chapter 7, The SoftC Library    41                                                                         41
  2387.  
  2388.  
  2389.           Prototype in          Prototype in          ____________
  2390.                     dbase.h
  2391.  
  2392.  
  2393.           Description          Description          ___________
  2394.                     scdopen opens a .DBF file. Memory will be allocated for                    scdopen                                                
  2395.                     a file packet and I/O buffers for use internally by the
  2396.                     SoftC file manager.
  2397.  
  2398.  
  2399.           Return Value          Return Value          ____________
  2400.                     SC_SUCCESS     file opened and memory allocated
  2401.                     SC_MEMERR      memory allocation failure
  2402.                     SC_NOFILE      .DBF file not found
  2403.                     SC_RDFAIL      disk read failure
  2404.                     SC_NODBF       file not in .DBF format
  2405.                     SC_SKFAIL      disk seek failure
  2406.                     SC_NOHNDL      no SoftC file handles available
  2407.                     SC_BADFNAME    invalid filename
  2408.  
  2409.  
  2410.           Example          Example          _______
  2411.  
  2412.           #include "SoftC.h"
  2413.           #include "dbase.h"
  2414.           
  2415.           void main()
  2416.           {
  2417.             char dbf;
  2418.           
  2419.             scinit(20,20);
  2420.             if (scdopen(&dbf,"TEST.DBF") == SC_SUCCESS)
  2421.               scdclose(dbf);
  2422.           
  2423.             scterm();
  2424.           }
  2425.  
  2426.  
  2427.  
  2428.  
  2429.  
  2430.           scdrclear          scdrclear          _________
  2431.  
  2432.  
  2433.  
  2434.  
  2435.           Usage          Usage          _____
  2436.                     signed short int scdrclear( signed char handle,                                     scdrclear                                                                                 ______ 
  2437.                                                 signed short int buffer );                                                                 ______   
  2438.  
  2439.  
  2440.           Prototype in          Prototype in          ____________
  2441.                     dbase.h
  2442.  
  2443.  
  2444.           42    Chapter 7, The SoftC Library          42                                
  2445.  
  2446.  
  2447.           Description          Description          ___________
  2448.                     scdrclear clears  a .DBF  I/O buffer.  buffer indicates                    scdrclear                                                                                                         ______          
  2449.                     which record buffer to clear.
  2450.  
  2451.  
  2452.                     buffer =       clears this buffer
  2453.                     SC_INPUT            input
  2454.                     SC_OUTPUT           output
  2455.  
  2456.  
  2457.           Return Value          Return Value          ____________
  2458.                     SC_SUCCESS     buffer cleared
  2459.                     SC_BADHNDL     .DBF file not open or bad handle
  2460.                     SC_BADCMD      invalid buffer
  2461.  
  2462.  
  2463.           Example          Example          _______
  2464.  
  2465.           #include "SoftC.h"
  2466.           #include "dbase.h"
  2467.           #include "windows.h"
  2468.           
  2469.           void main()
  2470.           {
  2471.             char dbf, character[17] = "Hello World!";
  2472.           
  2473.             scinit(20,20);
  2474.             if (scdopen(&dbf,"TEST.DBF") == SC_SUCCESS) {
  2475.               scdfputs(dbf,0,"SoftC Library   ");
  2476.               scdrclear(dbf,SC_INPUT);
  2477.               scdrcopy(dbf,SC_OUTPUT);
  2478.               scdfgets(dbf,0,character);
  2479.               scwprintf("%s\n",character);
  2480.             }
  2481.             scterm();
  2482.           }
  2483.  
  2484.  
  2485.  
  2486.  
  2487.  
  2488.           scdrcopy          scdrcopy          ________
  2489.  
  2490.  
  2491.  
  2492.  
  2493.           Usage          Usage          _____
  2494.                     signed short int scdrcopy( signed char handle,                                     scdrcopy                                                                                ______ 
  2495.                                                signed short int buffer );                                                                ______   
  2496.  
  2497.  
  2498.           Prototype in          Prototype in          ____________
  2499.                     dbase.h
  2500.  
  2501.  
  2502.                                          Chapter 7, The SoftC Library    43                                                                         43
  2503.  
  2504.  
  2505.           Description          Description          ___________
  2506.                     scdrcopy copies  the contents  of one I/O buffer to the                    scdrcopy                                               
  2507.                     other. buffer indicates the direction of the copy.                           ______                                     
  2508.  
  2509.  
  2510.                     buffer =       copies this way
  2511.                     SC_INPUT            input to output
  2512.                     SC_OUTPUT           output to input
  2513.  
  2514.  
  2515.           Return Value          Return Value          ____________
  2516.                     SC_SUCCESS     buffer copy
  2517.                     SC_BADHNDL     .DBF file not open or bad handle
  2518.                     SC_BADCMD      invalid buffer
  2519.  
  2520.  
  2521.           Example          Example          _______
  2522.  
  2523.           #include "SoftC.h"
  2524.           #include "dbase.h"
  2525.           #include "windows.h"
  2526.           
  2527.           void main()
  2528.           {
  2529.             char dbf, character[17] = "Hello World!";
  2530.           
  2531.             scinit(20,20);
  2532.             if (scdopen(&dbf,"TEST.DBF") == SC_SUCCESS) {
  2533.               scdfputs(dbf,0,"SoftC Library   ");
  2534.               scdrclear(dbf,SC_INPUT);
  2535.               scdrcopy(dbf,SC_OUTPUT);
  2536.               scdfgets(dbf,0,character);
  2537.               scwprintf("%s\n",character);
  2538.               scdclose(dbf);
  2539.             }
  2540.             scterm();
  2541.           }
  2542.  
  2543.  
  2544.  
  2545.  
  2546.  
  2547.           scdrdel          scdrdel          _______
  2548.  
  2549.  
  2550.  
  2551.  
  2552.           Usage          Usage          _____
  2553.                     signed short int scdrdel( signed char handle,                                     scdrdel                                                                               ______ 
  2554.                                               signed long int recno );                                                              _____   
  2555.  
  2556.  
  2557.           Prototype in          Prototype in          ____________
  2558.                     dbase.h
  2559.  
  2560.  
  2561.           44    Chapter 7, The SoftC Library          44                                
  2562.  
  2563.  
  2564.           Description          Description          ___________
  2565.                     scdrdel will  flag  a  record  specified  by  recno  as                    scdrdel                                                                                                                  _____    
  2566.                     'deleted'. To  maintain compatibility with dBaseIII the
  2567.                     data record cannot be reused, but it can be 'undeleted'
  2568.                     by scdrundel.                       scdrundel 
  2569.  
  2570.  
  2571.           See also          See also          ________
  2572.                     scdrundel.                    scdrundel 
  2573.  
  2574.  
  2575.           Return Value          Return Value          ____________
  2576.                     SC_SUCCESS     record marked 'deleted'
  2577.                     SC_BADHNDL     .DBF file not open or bad handle
  2578.                     SC_SKFAIL      invalid data record number or disk seek
  2579.                                    failure
  2580.                     SC_RDFAIL      disk read failure
  2581.                     SC_WRTFAIL     disk write failure
  2582.  
  2583.  
  2584.           Example          Example          _______
  2585.  
  2586.           #include "SoftC.h"
  2587.           #include "dbase.h"
  2588.           #include "windows.h"
  2589.           
  2590.           void main()
  2591.           {
  2592.             char dbf;
  2593.           
  2594.             scinit(20,20);
  2595.             if (scdopen(&dbf,"TEST.DBF") == SC_SUCCESS) {
  2596.               scdrdel(dbf,1L);
  2597.               scdrget(dbf,1L);
  2598.               scwprintf("%s\n",scemsg());
  2599.               scdclose(dbf);
  2600.             }
  2601.             scterm();
  2602.           }
  2603.  
  2604.  
  2605.  
  2606.  
  2607.  
  2608.           scdrget          scdrget          _______
  2609.  
  2610.  
  2611.  
  2612.  
  2613.           Usage          Usage          _____
  2614.                     signed short int scdrget( signed char handle,                                     scdrget                                                                               ______ 
  2615.                                               signed long int recno );                                                              _____   
  2616.  
  2617.  
  2618.                                          Chapter 7, The SoftC Library    45                                                                         45
  2619.  
  2620.  
  2621.           Prototype in          Prototype in          ____________
  2622.                     dbase.h
  2623.  
  2624.  
  2625.           Description          Description          ___________
  2626.                     scdrget will  read the  data record  specified by recno                    scdrget                                                                                                                      _____
  2627.                     from the  .DBF file  associated with  handle  into  the
  2628.                     internal input buffer.
  2629.  
  2630.  
  2631.           See also          See also          ________
  2632.                     scdfget, scdfputs, scdrget.                    scdfget  scdfputs  scdrget 
  2633.  
  2634.  
  2635.           Return Value          Return Value          ____________
  2636.                     SC_SUCCESS     record read
  2637.                     SC_BADHNDL     .DBF file not open or bad handle
  2638.                     SC_SKFAIL      invalid data record number or disk seek
  2639.                                    failure
  2640.                     SC_RDFAIL      disk read failure
  2641.                     SC_DELREC      record read was marked 'deleted'
  2642.  
  2643.  
  2644.           Example          Example          _______
  2645.  
  2646.           #include "SoftC.h"
  2647.           #include "dbase.h"
  2648.           #include "windows.h"
  2649.           
  2650.           void main()
  2651.           {
  2652.             char dbf, character[17] = "Hello",
  2653.                  logical = 'F', date[9] = "12/25/88";
  2654.             double numeric = 150.00L;
  2655.           
  2656.             scinit(20,20);
  2657.             if (scdopen(&dbf,"TEST.DBF") == SC_SUCCESS) {
  2658.               scdrget(dbf,1L);
  2659.               scdfgets(dbf,0,character);
  2660.               scdfgets(dbf,1,date);
  2661.               scdfget(dbf,2,(void *) &logical);
  2662.               scdfget(dbf,3,(void *) &numeric);
  2663.               scwprintf("%s %s %c %lf\n",
  2664.                 character,date,logical,numeric);
  2665.               scdclose(dbf);
  2666.             }
  2667.             scterm();
  2668.           }
  2669.  
  2670.  
  2671.           46    Chapter 7, The SoftC Library          46                                
  2672.  
  2673.  
  2674.           scdrinfo          scdrinfo          ________
  2675.  
  2676.  
  2677.  
  2678.  
  2679.           Usage          Usage          _____
  2680.                     signed short int scdrinfo( signed char handle,                                     scdrinfo                                                                                ______ 
  2681.                                                signed long int *reclen,                                                                ______ 
  2682.                                                signed char *numflds,                                                            _______ 
  2683.                                                void **ibfr,                                                      ____ 
  2684.                                                void **obfr );                                                      ____   
  2685.  
  2686.  
  2687.           Prototype in          Prototype in          ____________
  2688.                     dbase.h
  2689.  
  2690.  
  2691.           Description          Description          ___________
  2692.                     scdrinfo gets  the data  record  length  (reclen),  the                    scdrinfo                                                                                                             ______       
  2693.                     number of  data fields  per record  (numflds), and  the                                                         _______           
  2694.                     addresses  of   the  input  (ibfr)  and  output  (obfr)                                                 ____                 ____ 
  2695.                     buffers.
  2696.  
  2697.  
  2698.           Return Value          Return Value          ____________
  2699.                     SC_SUCCESS     requested information returned
  2700.                     SC_BADHNDL     .DBF file not open or bad handle
  2701.  
  2702.  
  2703.           Example          Example          _______
  2704.  
  2705.           #include "SoftC.h"
  2706.           #include "dbase.h"
  2707.           #include "windows.h"
  2708.           
  2709.           void main()
  2710.           {
  2711.             char dbf, numflds;
  2712.             short reclen;
  2713.             void *ibfr, *obfr;
  2714.           
  2715.             scinit(20,20);
  2716.             if (scdopen(&dbf,"TEST.DBF") == SC_SUCCESS) {
  2717.               scdrinfo(dbf,&reclen,&numflds,&ibfr,&obfr);
  2718.               scwprintf("Record length = %d\n",reclen);
  2719.               scwprintf("Number of fields = %d\n",numflds);
  2720.               scwprintf("I/O buffers = %p %p\n",ibfr,obfr);
  2721.               scdclose(dbf);
  2722.             }
  2723.             scterm();
  2724.           }
  2725.  
  2726.  
  2727.                                          Chapter 7, The SoftC Library    47                                                                         47
  2728.  
  2729.  
  2730.           scdrput          scdrput          _______
  2731.  
  2732.  
  2733.  
  2734.  
  2735.           Usage          Usage          _____
  2736.                     signed short int scdrput( signed char handle,                                     scdrput                                                                               ______ 
  2737.                                               signed short int howto,                                                               _____ 
  2738.                                               signed long int *recno );                                                               _____   
  2739.  
  2740.  
  2741.           Prototype in          Prototype in          ____________
  2742.                     dbase.h
  2743.  
  2744.  
  2745.           Description          Description          ___________
  2746.                     scdrput will  write the  data record specified by recno                    scdrput                                                                                                                      _____
  2747.                     to the  .DBF  file  associated  with  handle  from  the                                                          ______           
  2748.                     internal output  buffer. howto  determines how the data                                             _____                         
  2749.                     record is to be written:
  2750.  
  2751.  
  2752.                     howto =        action
  2753.                     SC_ADD           record appended to end of file
  2754.                     SC_UPDATE        current record updated
  2755.  
  2756.  
  2757.                     If a  record update is occurring the data record number
  2758.                     associated with  the record in the input buffer will be
  2759.                     returned. An  update will not be performed if the input
  2760.                     buffer is  empty. Use  scdrget to load a data record or                                           scdrget                         
  2761.                     scdfput or  scdfputs to  fill the  data record field by                    scdfput     scdfputs                                   
  2762.                     field.
  2763.  
  2764.  
  2765.           See also          See also          ________
  2766.                     scdfput, scdfputs, scdrget.                    scdfput  scdfputs  scdrget 
  2767.  
  2768.  
  2769.           Return Value          Return Value          ____________
  2770.                     SC_SUCCESS     record read
  2771.                     SC_BADHNDL     .DBF file not open or bad handle
  2772.                     SC_SKFAIL      invalid data record number or disk seek
  2773.                                    failure
  2774.                     SC_WRTFAIL     disk write failure
  2775.                     SC_BADCMD      invalid record write command
  2776.  
  2777.  
  2778.           Example          Example          _______
  2779.  
  2780.           #include "SoftC.h"
  2781.           #include "dbase.h"
  2782.           #include "windows.h"
  2783.           
  2784.  
  2785.  
  2786.           48    Chapter 7, The SoftC Library          48                                
  2787.  
  2788.  
  2789.           void main()
  2790.           {
  2791.             char dbf, logical = 'T', date[9] = "19881225";
  2792.             long recno;
  2793.             double numeric = 20.0L;
  2794.           
  2795.             scinit(20,20);
  2796.             if (scdopen(&dbf,"TEST.DBF") == SC_SUCCESS) {
  2797.               scdfputs(dbf,0,"SoftC Library   ");
  2798.               scdfput(dbf,1,(void *) date);
  2799.               scdfput(dbf,2,(void *) &logical);
  2800.               scdfput(dbf,3,(void *) &numeric);
  2801.               scdrput(dbf,SC_ADD,&recno);
  2802.               scwprintf("Record number = %ld\n",recno);
  2803.               scdclose(dbf);
  2804.             }
  2805.             scterm();
  2806.           }
  2807.  
  2808.  
  2809.  
  2810.  
  2811.  
  2812.           scdrundel          scdrundel          _________
  2813.  
  2814.  
  2815.  
  2816.  
  2817.           Usage          Usage          _____
  2818.                     signed short int scdrundel( signed char handle,                                     scdrundel                                                                                 ______ 
  2819.                                                 signed long int recno );                                                                _____   
  2820.  
  2821.  
  2822.           Prototype in          Prototype in          ____________
  2823.                     dbase.h
  2824.  
  2825.  
  2826.           Description          Description          ___________
  2827.                     scdrundel will  remove the 'deleted' flag from the data                    scdrundel                                              
  2828.                     record specified by recno.                                        _____ 
  2829.  
  2830.  
  2831.           See also          See also          ________
  2832.                     scdrdel.                    scdrdel 
  2833.  
  2834.  
  2835.           Return Value          Return Value          ____________
  2836.                     SC_SUCCESS     record recovered
  2837.                     SC_BADHNDL     .DBF file not open or bad handle
  2838.                     SC_SKFAIL      invalid data record number or disk seek
  2839.                                    failure
  2840.                     SC_RDFAIL      disk read failure
  2841.                     SC_WRTFAIL     disk write failure
  2842.  
  2843.  
  2844.                                          Chapter 7, The SoftC Library    49                                                                         49
  2845.  
  2846.  
  2847.           Example          Example          _______
  2848.  
  2849.           #include "SoftC.h"
  2850.           #include "dbase.h"
  2851.           #include "windows.h"
  2852.           
  2853.           void main()
  2854.           {
  2855.             char dbf;
  2856.             long recno;
  2857.           
  2858.             scinit(20,20);
  2859.             if (scdopen(&dbf,"TEST.DBF") == SC_SUCCESS) {
  2860.               scdrundel(dbf,1L);
  2861.               scdrget(dbf,1L);
  2862.               scwprintf("%s\n",scemsg());
  2863.               scdclose(dbf);
  2864.             }
  2865.             scterm();
  2866.           }
  2867.  
  2868.  
  2869.  
  2870.  
  2871.  
  2872.           scdsize          scdsize          _______
  2873.  
  2874.  
  2875.  
  2876.  
  2877.           Usage          Usage          _____
  2878.                     signed short int scdsize( signed char handle,                                     scdsize                                                                               ______ 
  2879.                                               signed long int *recsused );                                                               ________   
  2880.  
  2881.  
  2882.           Prototype in          Prototype in          ____________
  2883.                     dbase.h
  2884.  
  2885.  
  2886.           Description          Description          ___________
  2887.                     scdsize gets the number of records in the .DBF file.                    scdsize                                             
  2888.  
  2889.  
  2890.           Return Value          Return Value          ____________
  2891.                     SC_SUCCESS     returned the number of records
  2892.                     SC_BADHNDL     .DBF file not open or bad handle
  2893.  
  2894.  
  2895.           Example          Example          _______
  2896.  
  2897.           #include "SoftC.h"
  2898.           #include "dbase.h"
  2899.           #include "windows.h"
  2900.           
  2901.  
  2902.  
  2903.           50    Chapter 7, The SoftC Library          50                                
  2904.  
  2905.  
  2906.           void main()
  2907.           {
  2908.             char dbf;
  2909.             long recsused;
  2910.           
  2911.             scinit(20,20);
  2912.             if (scdopen(&dbf,"TEST.DBF") == SC_SUCCESS) {
  2913.               scdsize(dbf,&recsused);
  2914.               scwprintf("%ld",recsused);
  2915.               scdclose(dbf);
  2916.             }
  2917.             scterm();
  2918.           }
  2919.  
  2920.  
  2921.  
  2922.  
  2923.  
  2924.           sceclr          sceclr          ______
  2925.  
  2926.  
  2927.  
  2928.  
  2929.           Usage          Usage          _____
  2930.                     void sceclr( void );                         sceclr         
  2931.  
  2932.  
  2933.           Prototype in          Prototype in          ____________
  2934.                     SoftC.h
  2935.  
  2936.  
  2937.           Description          Description          ___________
  2938.                     sceclr  will   clear  the   SoftC  library  error  flag                    sceclr                                                 
  2939.                     (sc_code).                     sc_code  
  2940.  
  2941.  
  2942.           See also          See also          ________
  2943.                     scemsg.                    scemsg 
  2944.  
  2945.  
  2946.           Return Value          Return Value          ____________
  2947.                     None.
  2948.  
  2949.  
  2950.           Example          Example          _______
  2951.  
  2952.           #include "SoftC.h"
  2953.           #include "windows.h"
  2954.           
  2955.           void main()
  2956.           {
  2957.             scinit(20,20);
  2958.             sceclr();
  2959.  
  2960.  
  2961.                                          Chapter 7, The SoftC Library    51                                                                         51
  2962.  
  2963.  
  2964.             scterm();
  2965.           }
  2966.  
  2967.  
  2968.  
  2969.  
  2970.  
  2971.           scemsg          scemsg          ______
  2972.  
  2973.  
  2974.  
  2975.  
  2976.           Usage          Usage          _____
  2977.                     signed char * scemsg( void );                                  scemsg         
  2978.  
  2979.  
  2980.           Prototype in          Prototype in          ____________
  2981.                     SoftC.h
  2982.  
  2983.  
  2984.           Description          Description          ___________
  2985.                     scemsg gets  the  SoftC  library  error  message  which                    scemsg                                                 
  2986.                     corresponds to the last known error.
  2987.  
  2988.  
  2989.                     Warning Codes and Messages:
  2990.  
  2991.  
  2992.                     1    "WARNING - record read is marked deleted",
  2993.                     2    "WARNING - file is empty",
  2994.                     3    "WARNING - no more keys",
  2995.                     4    "WARNING - could not find key in index file"
  2996.  
  2997.  
  2998.                     Error Codes and Messages:
  2999.  
  3000.  
  3001.                     -1   "ERROR - file write failure",
  3002.                     -2   "ERROR - file read failure",
  3003.                     -3   "ERROR - memory allocation error",
  3004.                     -4   "ERROR - bad user specified field description",
  3005.                     -5   "ERROR - file not in .DBF format",
  3006.                     -6   "ERROR - file pointer reposition failed",
  3007.                     -7   "ERROR - file not found",
  3008.                     -8   "ERROR - file corrupted",
  3009.                     -9   "ERROR - bad user specified key expression",
  3010.                     -10  "ERROR - file not in .NDX format",
  3011.                     -11  "ERROR - no handles available",
  3012.                     -12  "ERROR - no index pages loaded",
  3013.                     -13  "ERROR - index page was not loaded",
  3014.                     -14  "ERROR - file close failure",
  3015.                     -15  "ERROR - invalid command",
  3016.                     -16  "ERROR - invalid handle number",
  3017.                     -17  "ERROR - invalid filename",
  3018.  
  3019.  
  3020.           52    Chapter 7, The SoftC Library          52                                
  3021.  
  3022.  
  3023.                     -18  "ERROR - invalid offset",
  3024.                     -19  "ERROR - bad window coordinates",
  3025.                     -20  "ERROR - window is overlaid by another",
  3026.                     -21  "ERROR - too many open windows",
  3027.                     -22  "ERROR - invalid date"
  3028.  
  3029.  
  3030.           See also          See also          ________
  3031.                     sceclr.                    sceclr 
  3032.  
  3033.  
  3034.           Return Value          Return Value          ____________
  3035.                     scemsg returns the error message.                    scemsg                           
  3036.  
  3037.  
  3038.           Example          Example          _______
  3039.  
  3040.           #include "SoftC.h"
  3041.           #include "windows.h"
  3042.           
  3043.           void main()
  3044.           {
  3045.             scinit(20,20);
  3046.             scwprintf("%s",scemsg());
  3047.             scterm();
  3048.           }
  3049.  
  3050.  
  3051.  
  3052.  
  3053.  
  3054.           sciclose          sciclose          ________
  3055.  
  3056.  
  3057.  
  3058.  
  3059.           Usage          Usage          _____
  3060.                     signed short int sciclose( signed char handle );                                     sciclose                                                                                  ______   
  3061.  
  3062.  
  3063.           Prototype in          Prototype in          ____________
  3064.                     dbase.h
  3065.  
  3066.  
  3067.           Description          Description          ___________
  3068.                     sciclose closes  an .NDX  file and  frees all allocated                    sciclose                                               
  3069.                     memory associated with .NDX file.
  3070.  
  3071.  
  3072.           Return Value          Return Value          ____________
  3073.                     SC_SUCCESS     .NDX file closed
  3074.                     SC_CLOSFAIL    file close failure
  3075.                     SC_BADHNDL     .NDX file not open or bad handle
  3076.  
  3077.  
  3078.                                          Chapter 7, The SoftC Library    53                                                                         53
  3079.  
  3080.  
  3081.           Example          Example          _______
  3082.  
  3083.           #include "SoftC.h"
  3084.           #include "dbase.h"
  3085.           
  3086.           void main()
  3087.           {
  3088.             char ndx;
  3089.           
  3090.             scinit(20,20);
  3091.             if (sciopen(&ndx,"TEST.NDX") == SC_SUCCESS)
  3092.               sciclose(ndx);
  3093.             scterm();
  3094.           }
  3095.  
  3096.  
  3097.  
  3098.  
  3099.  
  3100.           scicreate          scicreate          _________
  3101.  
  3102.  
  3103.  
  3104.  
  3105.           Usage          Usage          _____
  3106.                     signed short int scicreate( signed char *filename,                                     scicreate                                                                                     ________ 
  3107.                                                 signed char keytype,                                                            _______ 
  3108.                                                 signed char *keyexpr,                                                             _______ 
  3109.                                                 signed char keylen );                                                            ______   
  3110.  
  3111.  
  3112.           Prototype in          Prototype in          ____________
  3113.                     dbase.h
  3114.  
  3115.  
  3116.           Description          Description          ___________
  3117.                     scicreate  creates   an  .NDX  file.  keyexpr  will  be                    scicreate                                                                                                        _______          
  3118.                     translated to  all upper  case when  the index  file is
  3119.                     created.
  3120.  
  3121.  
  3122.                     If keytype  is 'c',  then keyexpr  must be  a character                       _______                _______                      
  3123.                     string consisting  of one  or more field names from the
  3124.                     data record. All fields included in the expression must
  3125.                     be of type 'c' or be translated into type 'c'. No check
  3126.                     is made to verify this. keylen cannot exceed 100.                                            ______                   
  3127.  
  3128.  
  3129.                     If keytype  is 'n'  or 'd', then keyexpr should consist                       _______                       _______               
  3130.                     of only  one data  field. keylen  will automatically be                                              ______                       
  3131.                     set to 8 (numeric and date keys are stored as doubles).
  3132.  
  3133.  
  3134.           54    Chapter 7, The SoftC Library          54                                
  3135.  
  3136.  
  3137.                     NOTE: scicreate will create a new .NDX file even if one                          scicreate                                        
  3138.                     had already existed.
  3139.  
  3140.  
  3141.                     NOTE: keyexpr  is used  by  dBaseIII.  keyexpr  is  NOT                          _______                          _______         
  3142.                     checked for  validity by  the SoftC  data file manager.
  3143.                     Currently only the scikmake function uses keyexpr.                                       scikmake                                                                                     _______ 
  3144.  
  3145.  
  3146.           See also          See also          ________
  3147.                     scikmake.                    scikmake 
  3148.  
  3149.  
  3150.           Return Value          Return Value          ____________
  3151.                     SC_SUCCESS     .NDX file created
  3152.                     SC_WRTFAIL     disk write failure
  3153.                     SC_BADEXPR     invalid keytype or bad keyexpr
  3154.                     SC_NOHNDL      no DOS handles available
  3155.  
  3156.  
  3157.           Example          Example          _______
  3158.  
  3159.           #include "SoftC.h"
  3160.           #include "dbase.h"
  3161.           
  3162.           void main()
  3163.           {
  3164.             scinit(20,20);
  3165.             scicreate("TEST.NDX",'d',"date",8);
  3166.             scterm();
  3167.           }
  3168.  
  3169.  
  3170.  
  3171.  
  3172.  
  3173.           sciexpr          sciexpr          _______
  3174.  
  3175.  
  3176.  
  3177.  
  3178.           Usage          Usage          _____
  3179.                     signed short int sciexpr( signed char handle,                                     sciexpr                                                                               ______ 
  3180.                                               signed char *keyexpr );                                                           _______   
  3181.  
  3182.  
  3183.           Prototype in          Prototype in          ____________
  3184.                     dbase.h
  3185.  
  3186.  
  3187.           Description          Description          ___________
  3188.                     sciexpr gets the index key expression and returns it as                    sciexpr                                                
  3189.                     a  character   string  into   a  user  supplied  buffer
  3190.                     (keyexpr). The  user must  ensure that  the  buffer  is                     _______                                               
  3191.  
  3192.  
  3193.                                          Chapter 7, The SoftC Library    55                                                                         55
  3194.  
  3195.  
  3196.                     large  enough   (the  key   expression  length  can  be
  3197.                     determined via  a call  to sciinfo)  to hold the entire                                               sciinfo                     
  3198.                     key expression.
  3199.  
  3200.  
  3201.           See also          See also          ________
  3202.                     sciinfo.                    sciinfo 
  3203.  
  3204.  
  3205.           Return Value          Return Value          ____________
  3206.                     SC_SUCCESS     returned the keyexpr
  3207.                     SC_BADHNDL     .NDX file not open or bad handle
  3208.  
  3209.  
  3210.           Example          Example          _______
  3211.  
  3212.           #include "SoftC.h"
  3213.           #include "dbase.h"
  3214.           #include "windows.h"
  3215.           
  3216.           void main()
  3217.           {
  3218.             char ndx, buffer[512];
  3219.           
  3220.             scinit(20,20);
  3221.             if (sciopen(&ndx,"TEST.NDX") == SC_SUCCESS) {
  3222.               sciexpr(ndx,buffer);
  3223.               scwprintf("key expression = %s",buffer);
  3224.               sciclose(ndx);
  3225.             }
  3226.             scterm();
  3227.           }
  3228.  
  3229.  
  3230.  
  3231.  
  3232.  
  3233.           sciinfo          sciinfo          _______
  3234.  
  3235.  
  3236.  
  3237.  
  3238.           Usage          Usage          _____
  3239.                     signed short int sciinfo( signed char handle,                                     sciinfo                                                                               ______ 
  3240.                                               signed char *filename,                                                           ________ 
  3241.                                               signed char *keytype,                                                           _______ 
  3242.                                               signed char *keylen,                                                           ______ 
  3243.                                               signed short int *exprlen );                                                                _______   
  3244.  
  3245.  
  3246.           Prototype in          Prototype in          ____________
  3247.                     dbase.h
  3248.  
  3249.  
  3250.           56    Chapter 7, The SoftC Library          56                                
  3251.  
  3252.  
  3253.           Description          Description          ___________
  3254.                     sciinfo gets  the filename  of the .NDX file associated                    sciinfo                                                
  3255.                     with handle,  the index key type (keytype), the maximum                         ______                       _______              
  3256.                     index key  length (keylen), and the length of the index                                       ______                              
  3257.                     key expression (exprlen).                                    _______  
  3258.  
  3259.  
  3260.           See also          See also          ________
  3261.                     sciopen.                    sciopen 
  3262.  
  3263.  
  3264.           Return Value          Return Value          ____________
  3265.                     SC_SUCCESS     returned .NDX file information
  3266.                     SC_BADHNDL     .NDX file not open or bad handle
  3267.  
  3268.  
  3269.           Example          Example          _______
  3270.  
  3271.           #include <dir.h>
  3272.           #include "SoftC.h"
  3273.           #include "dbase.h"
  3274.           #include "windows.h"
  3275.           
  3276.           void main()
  3277.           {
  3278.             char ndx, filename[MAXPATH], keytype, keylen, exprlen;
  3279.           
  3280.             scinit(20,20);
  3281.             if (sciopen(&ndx,"TEST.NDX") == SC_SUCCESS) {
  3282.               sciinfo(ndx,filename,&keytype,&keylen,&exprlen);
  3283.               scwprintf("File name = %s\n",filename);
  3284.               scwprintf("Index key type = %c\n",keytype);
  3285.               scwprintf("Maximum key length = %d\n",keylen);
  3286.               scwprintf("Key expression length = %d\n",exprlen);
  3287.               sciclose(ndx);
  3288.             }
  3289.             scterm();
  3290.           }
  3291.  
  3292.  
  3293.  
  3294.  
  3295.  
  3296.           scikadd          scikadd          _______
  3297.  
  3298.  
  3299.  
  3300.  
  3301.           Usage          Usage          _____
  3302.                     signed short int scikadd( signed char handle,                                     scikadd                     
  3303.                                               signed char *key,
  3304.                                               signed long int recno );
  3305.  
  3306.  
  3307.                                          Chapter 7, The SoftC Library    57                                                                         57
  3308.  
  3309.  
  3310.           Prototype in          Prototype in          ____________
  3311.                     dbase.h
  3312.  
  3313.  
  3314.           Description          Description          ___________
  3315.                     scikadd will  add key  to the  index file  specified by                    scikadd                                                                                      ___                                  
  3316.                     handle.  recno   is  the   data  record  number  to  be                             _____                                         
  3317.                     associated with  key (the  data record  pointed  to  by                                     ___                                   
  3318.                     recno must exist prior to calling scikadd).                                                      scikadd  
  3319.  
  3320.  
  3321.           Return Value          Return Value          ____________
  3322.                     SC_SUCCESS     key added to .NDX file
  3323.                     SC_BADHNDL     .NDX file not open or bad handle
  3324.                     SC_SKFAIL      disk seek failure
  3325.                     SC_WRTFAIL     disk write failure
  3326.                     SC_RDFAIL      disk read failure
  3327.                     SC_MEMERR      memory allocation failure
  3328.  
  3329.  
  3330.           Example          Example          _______
  3331.  
  3332.           #include <string.h>
  3333.           #include "SoftC.h"
  3334.           #include "dbase.h"
  3335.           
  3336.           void main()
  3337.           {
  3338.             char dbf, ndx, date[9];
  3339.             short result;
  3340.             long recno;
  3341.           
  3342.             scinit(20,20);
  3343.             if (scdopen(&dbf,"TEST.DBF") == SC_SUCCESS) {
  3344.               if (sciopen(&ndx,"TEST.NDX") == SC_SUCCESS) {
  3345.                 strcpy(date,"19881201");
  3346.                 scdfputs(dbf,1,date);
  3347.                 result = scdrput(dbf,SC_ADD,&recno)
  3348.                 if (result == SC_SUCCESS)
  3349.                   scikadd(ndx,date,recno);
  3350.                 sciclose(ndx);
  3351.               }
  3352.               scdclose(dbf)
  3353.             }
  3354.             scterm();
  3355.           }
  3356.  
  3357.  
  3358.           58    Chapter 7, The SoftC Library          58                                
  3359.  
  3360.  
  3361.           scikcur          scikcur          _______
  3362.  
  3363.  
  3364.  
  3365.  
  3366.           Usage          Usage          _____
  3367.                     signed short int scikcur( signed char handle,                                     scikcur                                                                               ______ 
  3368.                                               signed char *key,                                                           ___ 
  3369.                                               signed long int *recno );                                                               _____   
  3370.  
  3371.  
  3372.           Prototype in          Prototype in          ____________
  3373.                     dbase.h
  3374.  
  3375.  
  3376.           Description          Description          ___________
  3377.                     scikcur will return the key value (key) and data record                    scikcur                                                                                                       ___                 
  3378.                     number (recno)  associated with  the current key in the                            _____                                          
  3379.                     index file.
  3380.  
  3381.  
  3382.                     The current key pointer must be set by a call to either
  3383.                     scikfind,  scikfirst,   or  sciklast   before   calling                    scikfind   scikfirst        sciklast                   
  3384.                     scikcur.                    scikcur 
  3385.  
  3386.  
  3387.                     The user must ensure that the buffer used to return the
  3388.                     key is  long enough to hold the entire key. The maximum
  3389.                     length of  the key  can be  determined via  a  call  to
  3390.                     sciinfo.                    sciinfo 
  3391.  
  3392.  
  3393.           See also          See also          ________
  3394.                     sciinfo, scikfind, scikfirst, and sciklast.                    sciinfo  scikfind  scikfirst      sciklast 
  3395.  
  3396.  
  3397.           Return Value          Return Value          ____________
  3398.                     SC_SUCCESS     key and recno returned
  3399.                     SC_BADHNDL     .NDX file not open or bad handle
  3400.                     SC_END         no current key - no call to scikfind,                                                               scikfind 
  3401.                                    scikfirst, or sciklast had been made to                                   scikfirst     sciklast                 
  3402.                                    initialize index pointers.
  3403.                     SC_RDFAIL      read index file failure
  3404.                     SC_SKFAIL      seek failure (bad record address or seek
  3405.                                    fail)
  3406.  
  3407.  
  3408.           Example          Example          _______
  3409.  
  3410.           #include "SoftC.h"
  3411.           #include "dbase.h"
  3412.           #include "windows.h"
  3413.           
  3414.           void main()
  3415.  
  3416.  
  3417.                                          Chapter 7, The SoftC Library    59                                                                         59
  3418.  
  3419.  
  3420.           {
  3421.             char ndx, date[9], dat[9];
  3422.             long recno, rnum;
  3423.           
  3424.             scinit(20,20);
  3425.             if (sciopen(&ndx,"TEST.NDX") == SC_SUCCESS) {
  3426.               date[8] = 0;
  3427.               dat[8] = 0;
  3428.               scikfirst(ndx,date,&recno);
  3429.               scikcur(ndx,dat,&rnum);
  3430.               scwprintf("%s %s %ld %ld\n",
  3431.                 date,dat,recno,rnum);
  3432.               sciclose(ndx);
  3433.             }
  3434.             scterm();
  3435.           }
  3436.  
  3437.  
  3438.  
  3439.  
  3440.  
  3441.           scikdel          scikdel          _______
  3442.  
  3443.  
  3444.  
  3445.  
  3446.           Usage          Usage          _____
  3447.                     signed short int scikdel( signed char handle,                                     scikdel                                                                               ______ 
  3448.                                               signed char *key,                                                           ___ 
  3449.                                               signed long int recno );                                                              _____   
  3450.  
  3451.  
  3452.           Prototype in          Prototype in          ____________
  3453.                     dbase.h
  3454.  
  3455.  
  3456.           Description          Description          ___________
  3457.                     scikdel will  remove key  from the index file specified                    scikdel                                                                                         ___                               
  3458.                     by handle.  recno is used along with key to ensure that                       ______   _____                                      
  3459.                     the proper key has been removed from the .NDX file.
  3460.  
  3461.  
  3462.           Return Value          Return Value          ____________
  3463.                     SC_SUCCESS     key removed from .NDX file
  3464.                     SC_BADHNDL     .NDX file not open or bad handle
  3465.                     SC_SKFAIL      disk seek failure
  3466.                     SC_WRTFAIL     disk write failure
  3467.                     SC_RDFAIL      index file read failure
  3468.                     SC_EMPTY       index file is empty - no keys found
  3469.                     SC_NOFIND      desired key was not found
  3470.  
  3471.  
  3472.           60    Chapter 7, The SoftC Library          60                                
  3473.  
  3474.  
  3475.           Example          Example          _______
  3476.  
  3477.           #include <string.h>
  3478.           #include "SoftC.h"
  3479.           #include "dbase.h"
  3480.           
  3481.           void main()
  3482.           {
  3483.             char ndx, date[9];
  3484.             long recno;
  3485.           
  3486.             scinit(20,20);
  3487.             if (sciopen(&ndx,"TEST.NDX") == SC_SUCCESS) {
  3488.               strcpy(date,"19881202");
  3489.               recno = 7L;
  3490.               scikdel(ndx,date,recno);
  3491.               sciclose(ndx);
  3492.             }
  3493.             scterm();
  3494.           }
  3495.  
  3496.  
  3497.  
  3498.  
  3499.  
  3500.           scikfind          scikfind          ________
  3501.  
  3502.  
  3503.  
  3504.  
  3505.           Usage          Usage          _____
  3506.                     signed short int scikfind( signed char handle,                                     scikfind                                                                                ______ 
  3507.                                                signed char method,                                                           ______ 
  3508.                                                signed char *key,                                                            ___ 
  3509.                                                signed long int *recno );                                                                _____   
  3510.  
  3511.  
  3512.           Prototype in          Prototype in          ____________
  3513.                     dbase.h
  3514.  
  3515.  
  3516.           Description          Description          ___________
  3517.                     need to explain the two methods of key searching.
  3518.  
  3519.  
  3520.                     scikfind searches  through the  .NDX file looking for a                    scikfind                                               
  3521.                     key and data record number match with key and recno. If                                                          ___     _____    
  3522.                     an exact match cannot be found, the current key will be
  3523.                     the physical  key which  would immediately precede key.                                                                       ___ 
  3524.                     The current  key's value and data record number will be
  3525.                     returned in key and recno.                                ___     _____ 
  3526.  
  3527.  
  3528.                                          Chapter 7, The SoftC Library    61                                                                         61
  3529.  
  3530.  
  3531.                     The user must ensure that the buffer used to return the
  3532.                     key is  long enough to hold the entire key. The maximum
  3533.                     length of  the key  can be  determined via  a  call  to
  3534.                     sciinfo.                    sciinfo 
  3535.  
  3536.  
  3537.           See also          See also          ________
  3538.                     sciinfo.                    sciinfo 
  3539.  
  3540.  
  3541.           Return Value          Return Value          ____________
  3542.                     SC_SUCCESS     key found
  3543.                     SC_NOFIND      key not found
  3544.                     SC_EMPTY       .NDX file empty - no keys found
  3545.                     SC_BADHNDL     .NDX file not open or bad handle
  3546.                     SC_SKFAIL      seek failure (bad record address or seek
  3547.                                    fail)
  3548.                     SC_RDFAIL      read index file failure
  3549.                     SC_END         end of index file
  3550.  
  3551.  
  3552.           Example          Example          _______
  3553.  
  3554.           #include <string.h>
  3555.           #include "SoftC.h"
  3556.           #include "dbase.h"
  3557.           #include "windows.h"
  3558.           void main()
  3559.           {
  3560.             char ndx, key[100];
  3561.             long recno;
  3562.             int result;
  3563.           
  3564.             scinit(20,20);
  3565.             if (sciopen(&ndx,"TEST.NDX") == SC_SUCCESS) {
  3566.               strcpy(date,"19881202");
  3567.               recno = 7L;
  3568.               scikfind(ndx,SC_EXACT,date,&recno);
  3569.               scwprintf("%s\n",scemsg());
  3570.               scdclose(ndx);
  3571.             }
  3572.             scterm();
  3573.           }
  3574.  
  3575.  
  3576.           62    Chapter 7, The SoftC Library          62                                
  3577.  
  3578.  
  3579.           scikfirst          scikfirst          _________
  3580.  
  3581.  
  3582.  
  3583.  
  3584.           Usage          Usage          _____
  3585.                     signed short int scikfirst( signed char handle,                                     scikfirst                                                                                 ______ 
  3586.                                                 signed char *key,                                                             ___ 
  3587.                                                 signed long int *recno );                                                                 _____   
  3588.  
  3589.  
  3590.           Prototype in          Prototype in          ____________
  3591.                     dbase.h
  3592.  
  3593.  
  3594.           Description          Description          ___________
  3595.                     scikfirst will set the current key pointer to the first                    scikfirst                                              
  3596.                     logical key  in the .NDX and return the key value (key)                                                                       ___ 
  3597.                     and data  record number (recno) associated with the new                                             _____                         
  3598.                     current key.
  3599.  
  3600.  
  3601.                     The user must ensure that the buffer used to return the
  3602.                     key is  long enough to hold the entire key. The maximum
  3603.                     length of  the key  can be  determined via  a  call  to
  3604.                     sciinfo.                    sciinfo 
  3605.  
  3606.  
  3607.           See also          See also          ________
  3608.                     sciinfo                    sciinfo
  3609.  
  3610.  
  3611.           Return Value          Return Value          ____________
  3612.                     SC_SUCCESS     key and recno returned
  3613.                     SC_BADHNDL     .NDX file not open or bad handle
  3614.                     SC_EMPTY       .NDX file empty - no keys found
  3615.                     SC_SKFAIL      seek failure
  3616.                     SC_RDFAIL      read index file failure
  3617.  
  3618.  
  3619.           Example          Example          _______
  3620.  
  3621.           #include "SoftC.h"
  3622.           #include "dbase.h"
  3623.           #include "windows.h"
  3624.           
  3625.           void main()
  3626.           {
  3627.             char ndx, date[9];
  3628.             long recno;
  3629.           
  3630.             scinit(20,20);
  3631.             if (sciopen(&ndx,"TEST.NDX") == SC_SUCCESS) {
  3632.               date[8] = 0;
  3633.  
  3634.  
  3635.                                          Chapter 7, The SoftC Library    63                                                                         63
  3636.  
  3637.  
  3638.               scikfirst(ndx,date,&recno);
  3639.               scwprintf("%d %ld\n",date,recno);
  3640.               sciclose(ndx);
  3641.             }
  3642.             scterm();
  3643.           }
  3644.  
  3645.  
  3646.  
  3647.  
  3648.  
  3649.           sciklast          sciklast          ________
  3650.  
  3651.  
  3652.  
  3653.  
  3654.           Usage          Usage          _____
  3655.                     signed short int sciklast( signed char handle,                                     sciklast                                                                                ______ 
  3656.                                                signed char *key,                                                            ___ 
  3657.                                                signed long int *recno );                                                                _____   
  3658.  
  3659.  
  3660.           Prototype in          Prototype in          ____________
  3661.                     dbase.h
  3662.  
  3663.  
  3664.           Description          Description          ___________
  3665.                     sciklast will  set the  current key pointer to the last                    sciklast                                               
  3666.                     logical key  in the .NDX and return the key value (key)                                                                       ___ 
  3667.                     and data  record number (recno) associated with the new                                             _____                         
  3668.                     current key.
  3669.  
  3670.  
  3671.                     The user must ensure that the buffer used to return the
  3672.                     key is  long enough to hold the entire key. The maximum
  3673.                     length of  the key  can be  determined via  a  call  to
  3674.                     sciinfo.                    sciinfo 
  3675.  
  3676.  
  3677.           See also          See also          ________
  3678.                     sciinfo.                    sciinfo 
  3679.  
  3680.  
  3681.           Return Value          Return Value          ____________
  3682.                     SC_SUCCESS     key and recno returned
  3683.                     SC_BADHNDL     .NDX file not open or bad handle
  3684.                     SC_EMPTY       .NDX file empty - no keys found
  3685.                     SC_SKFAIL      seek failure
  3686.                     SC_RDFAIL      read from index file failure
  3687.  
  3688.  
  3689.           64    Chapter 7, The SoftC Library          64                                
  3690.  
  3691.  
  3692.           Example          Example          _______
  3693.  
  3694.           #include "SoftC.h"
  3695.           #include "dbase.h"
  3696.           #include "windows.h"
  3697.           
  3698.           void main()
  3699.           {
  3700.             char ndx, date[9];
  3701.             long recno;
  3702.           
  3703.             scinit(20,20);
  3704.             if (sciopen(&ndx,"TEST.NDX") == SC_SUCCESS) {
  3705.               date[8] = 0;
  3706.               sciklast(ndx,date,&recno);
  3707.               scwprintf("%s %ld\n",date,recno);
  3708.               sciclose(ndx);
  3709.             }
  3710.             scterm();
  3711.           }
  3712.  
  3713.  
  3714.  
  3715.  
  3716.  
  3717.           scikmake          scikmake          ________
  3718.  
  3719.  
  3720.  
  3721.  
  3722.           Usage          Usage          _____
  3723.                     signed short int scikmake( signed char datahandle,                                     scikmake                                                                                    __________ 
  3724.                                                signed char indexhandle,                                                           ___________ 
  3725.                                                void ** key );                                                       ___   
  3726.  
  3727.  
  3728.           Prototype in          Prototype in          ____________
  3729.                     dbase.h
  3730.  
  3731.  
  3732.           Description          Description          ___________
  3733.                     scikmake  will   build  an  index  key  using  the  key                    scikmake                                               
  3734.                     expression of  the index  file specified by indexhandle                                                                ___________
  3735.                     and the  data found  in the  output buffer  of the data
  3736.                     file of  datahandle. Memory  space for  the key will be                             __________                         ___        
  3737.                     allocated  and  the  address  of  this  block  will  be
  3738.                     returned.
  3739.  
  3740.  
  3741.                     The key expression can consist of either the data field
  3742.                     name or one of five dBaseIII functions or a combination
  3743.                     thereof.  Data   field  types   of  date,  numeric,  or
  3744.                     character are  allowed. dBaseIII  functions dtoc, left,                                                                dtoc  left 
  3745.  
  3746.  
  3747.                                          Chapter 7, The SoftC Library    65                                                                         65
  3748.  
  3749.  
  3750.                     right,  str,   and  substr  are  current  supported  by                    right   str         substr                             
  3751.                     scikmake.                    scikmake 
  3752.  
  3753.  
  3754.                     dBaseIII supports only two types of keys: character and
  3755.                     numeric. The  only numeric  keys supported by SoftC are
  3756.                     just the date and numeric data field names.
  3757.  
  3758.  
  3759.                     dtoc will convert data from a date field to a character                    dtoc                                                   
  3760.                     string   of    the   format    mm/dd/yy.   Syntax    is
  3761.                     dtoc(field_name).
  3762.  
  3763.  
  3764.                     left will  return the left portion of a character field                    left                                                   
  3765.                     as a  string. The  number  of  characters  returned  is
  3766.                     specified   after    the   field    name.   Syntax   is
  3767.                     left(field_name,number).
  3768.  
  3769.  
  3770.                     right will  return the  right portion  of  a  character                    right                                                  
  3771.                     field as a string. The number of characters returned is
  3772.                     specified after  the field  name. This  is a count from
  3773.                     the   right    side   of    the   field.    Syntax   is
  3774.                     right(field_name,count).
  3775.  
  3776.  
  3777.                     str will  convert a  numeric field  to an ascii string.                    str                                                    
  3778.                     The total  length of  the  string  and  the  number  of
  3779.                     decimal places  are optional  parameters.  The  default
  3780.                     string length is 10 and the number of decimal places is
  3781.                     0. Syntax is str(field_name,length,decimal_places).
  3782.  
  3783.  
  3784.                     substr will  return the  middle portion  of a character                    substr                                                 
  3785.                     field. The starting offset into the field is a required
  3786.                     parameter. The  number of  characters to  be used is an
  3787.                     optional parameter whose default value is the remainder
  3788.                     of the field. Syntax is substr(field_name,start,count).
  3789.  
  3790.  
  3791.                     An example of a more complex key expression:
  3792.  
  3793.  
  3794.                     right(dtoc(date),2)+left(dtoc(date,2)
  3795.  
  3796.  
  3797.                     This expression would cause scikmake to create an index                                                scikmake                   
  3798.                     key string  consisting of  the year and month ("yymm").
  3799.                     For example  if date equals "2/13/89" the resultant key
  3800.                     would be "8902".
  3801.  
  3802.  
  3803.           66    Chapter 7, The SoftC Library          66                                
  3804.  
  3805.  
  3806.                     Note that  for key  expressions consisting  of only one
  3807.                     data field  scikmake is  probably an  overkill. You can                                scikmake                                   
  3808.                     easily generate  these keys  yourself.  scikmake  is  a                                                            scikmake       
  3809.                     fairly large  module and  if not needed probably should
  3810.                     not be  used. This  function is  best used when the key
  3811.                     expression is more complex.
  3812.  
  3813.  
  3814.           See also          See also          ________
  3815.                     scicreate.                    scicreate 
  3816.  
  3817.  
  3818.           Return Value          Return Value          ____________
  3819.                     SC_SUCCESS     key and recno returned
  3820.                     SC_BADHNDL     .NDX file not open or bad handle
  3821.                     SC_MEMERR      memory allocation failure
  3822.                     SC_BADEXPR     invalid key expression
  3823.  
  3824.  
  3825.           Example          Example          _______
  3826.  
  3827.           #include "SoftC.h"
  3828.           #include "dbase.h"
  3829.           #include "windows.h"
  3830.           
  3831.           void main()
  3832.           {
  3833.             char ndx, dbf, char *key, date[9];
  3834.             long recno;
  3835.           
  3836.             scinit(20,20);
  3837.             if (scdopen(&dbf,"TEST.DBF") == SC_SUCCESS) {
  3838.               if (sciopen(&ndx,"TEST.NDX") == SC_SUCCESS) {
  3839.                 scdfput(dbf,0,&date);
  3840.                 scdrput(dbf,SC_ADD,&recno);
  3841.                 scikmake(dbf,ndx,(void **) &key);
  3842.                 scikadd(ndx,key,recno);
  3843.                 free(key);
  3844.                 sciclose(ndx);
  3845.               }
  3846.               scdclose(dbf);
  3847.             }
  3848.             scterm();
  3849.           }
  3850.  
  3851.  
  3852.                                          Chapter 7, The SoftC Library    67                                                                         67
  3853.  
  3854.  
  3855.           sciknext          sciknext          ________
  3856.  
  3857.  
  3858.  
  3859.  
  3860.           Usage          Usage          _____
  3861.                     signed short int sciknext( signed char handle,                                     sciknext                                                                                ______ 
  3862.                                                signed char *key,                                                            ___ 
  3863.                                                signed long int *recno );                                                                _____   
  3864.  
  3865.  
  3866.           Prototype in          Prototype in          ____________
  3867.                     dbase.h
  3868.  
  3869.  
  3870.           Description          Description          ___________
  3871.                     sciknext will  increment the key pointer and return the                    sciknext                                               
  3872.                     key  value   (key)  and   data  record  number  (recno)                                  ___                                _____ 
  3873.                     associated with the new current key.
  3874.  
  3875.  
  3876.                     The current key pointer must be set by a call to either
  3877.                     scikfind,  scikfirst,   or  sciklast   before   calling                    scikfind   scikfirst        sciklast                   
  3878.                     sciknext.                    sciknext 
  3879.  
  3880.  
  3881.                     The user must ensure that the buffer used to return the
  3882.                     key is  long enough to hold the entire key. The maximum
  3883.                     length of  the key  can be  determined via  a  call  to
  3884.                     sciinfo.                    sciinfo 
  3885.  
  3886.  
  3887.           See also          See also          ________
  3888.                     sciinfo, scikfind, scikfirst, and sciklast.                    sciinfo  scikfind  scikfirst      sciklast 
  3889.  
  3890.  
  3891.           Return Value          Return Value          ____________
  3892.                     SC_SUCCESS     key and recno returned
  3893.                     SC_BADHNDL     .NDX file not open or bad handle
  3894.                     SC_END         no more keys - at end of .NDX file
  3895.                     SC_RDFAIL      index file read failure
  3896.                     SC_SKFAIL      seek failure (bad record address or seek
  3897.                                    failed)
  3898.  
  3899.  
  3900.           Example          Example          _______
  3901.  
  3902.           #include "SoftC.h"
  3903.           #include "dbase.h"
  3904.           #include "windows.h"
  3905.           
  3906.           void main()
  3907.           {
  3908.             char ndx, date[9];
  3909.  
  3910.  
  3911.           68    Chapter 7, The SoftC Library          68                                
  3912.  
  3913.  
  3914.             long recno;
  3915.           
  3916.             scinit(20,20);
  3917.             if (sciopen(&ndx,"TEST.NDX") == SC_SUCCESS) {
  3918.               scikfirst(ndx,date,&recno);
  3919.               sciknext(ndx,date,&recno);
  3920.               scwprintf("%s %ld\n",date,recno);
  3921.               sciclose(ndx);
  3922.             }
  3923.             scterm();
  3924.           }
  3925.  
  3926.  
  3927.  
  3928.  
  3929.  
  3930.           scikprev          scikprev          ________
  3931.  
  3932.  
  3933.  
  3934.  
  3935.           Usage          Usage          _____
  3936.                     signed short int scikprev( signed char handle,                                     scikprev                                                                                ______ 
  3937.                                                signed char *key,                                                            ___ 
  3938.                                                signed long int *recno );                                                                _____   
  3939.  
  3940.  
  3941.           Prototype in          Prototype in          ____________
  3942.                     dbase.h
  3943.  
  3944.  
  3945.           Description          Description          ___________
  3946.                     scikprev will  decrement the key pointer and return the                    scikprev                                               
  3947.                     key  value   (key)  and   data  record  number  (recno)                                  ___                                _____ 
  3948.                     associated with the new current key.
  3949.  
  3950.  
  3951.                     The current key pointer must be set by a call to either
  3952.                     scikfind,  scikfirst,   or  sciklast   before   calling                    scikfind   scikfirst        sciklast                   
  3953.                     scikprev.                    scikprev 
  3954.  
  3955.  
  3956.                     The user must ensure that the buffer used to return the
  3957.                     key is  long enough to hold the entire key. The maximum
  3958.                     length of  the key  can be  determined via  a  call  to
  3959.                     sciinfo.                    sciinfo 
  3960.  
  3961.  
  3962.           See also          See also          ________
  3963.                     sciinfo, scikfind, scikfirst, and sciklast.                    sciinfo  scikfind  scikfirst      sciklast 
  3964.  
  3965.  
  3966.           Return Value          Return Value          ____________
  3967.                     SC_SUCCESS     key and recno returned
  3968.  
  3969.  
  3970.                                          Chapter 7, The SoftC Library    69                                                                         69
  3971.  
  3972.  
  3973.                     SC_BADHNDL     .NDX file not open or bad handle
  3974.                     SC_END         no more keys - at end of .NDX file
  3975.                     SC_RDFAIL      index file read failure
  3976.                     SC_SKFAIL      index file record seek failure
  3977.  
  3978.  
  3979.           Example          Example          _______
  3980.  
  3981.           #include "SoftC.h"
  3982.           #include "dbase.h"
  3983.           #include "windows.h"
  3984.           
  3985.           void main()
  3986.           {
  3987.             char ndx, date[9];
  3988.             long recno;
  3989.           
  3990.             scinit(20,20);
  3991.             if (sciopen(&ndx,"TEST.NDX") == SC_SUCCESS) {
  3992.               sciklast(ndx,date,&recno);
  3993.               scikprev(ndx,date,&recno);
  3994.               scwprintf("%s %ld\n",date,recno);
  3995.               sciclose(ndx);
  3996.             }
  3997.             scterm();
  3998.           }
  3999.  
  4000.  
  4001.  
  4002.  
  4003.  
  4004.           scinit          scinit          ______
  4005.  
  4006.  
  4007.  
  4008.  
  4009.           Usage          Usage          _____
  4010.                     signed short int scinit( signed char files,                                     scinit                                                                             _____ 
  4011.                                              signed char windows );                                                         _______   
  4012.  
  4013.  
  4014.           Prototype in          Prototype in          ____________
  4015.                     SoftC.h
  4016.  
  4017.  
  4018.           Description          Description          ___________
  4019.                     scinit is called once and only once at the beginning of                    scinit                                                 
  4020.                     the program. The maximum numbers of simultaneously open
  4021.                     files and windows are passed. This function sets up the                    _____     _______                                      
  4022.                     SoftC  environment   for  processing.  Memory  will  be
  4023.                     allocated for  a variety  of  control  structures  used
  4024.                     internally by the SoftC manager.
  4025.  
  4026.  
  4027.           70    Chapter 7, The SoftC Library          70                                
  4028.  
  4029.  
  4030.           See also          See also          ________
  4031.                     scterm.                    scterm 
  4032.  
  4033.  
  4034.           Return Value          Return Value          ____________
  4035.                     SC_SUCCESS     completed initialization
  4036.                     SC_MEMERR      memory allocation failure
  4037.                     SC_BADHNDL     invalid number of handles
  4038.  
  4039.  
  4040.           Example          Example          _______
  4041.  
  4042.           #include "SoftC.h"
  4043.           
  4044.           void main()
  4045.           {
  4046.             scinit(20,20);
  4047.             scterm();
  4048.           }
  4049.  
  4050.  
  4051.  
  4052.  
  4053.  
  4054.           sciopen          sciopen          _______
  4055.  
  4056.  
  4057.  
  4058.  
  4059.           Usage          Usage          _____
  4060.                     signed short int sciopen( signed char *handle,                                     sciopen                                                                                 ______ 
  4061.                                               signed char *filename );                                                           ________   
  4062.  
  4063.  
  4064.           Prototype in          Prototype in          ____________
  4065.                     dbase.h
  4066.  
  4067.  
  4068.           Description          Description          ___________
  4069.                     sciopen opens  an .NDX  file. Memory  will be allocated                    sciopen                                                
  4070.                     for a file packet, I/O buffers, and other miscellaneous
  4071.                     structures  for   use  internally  by  the  SoftC  file
  4072.                     manager.
  4073.  
  4074.  
  4075.           Return Value          Return Value          ____________
  4076.                     SC_SUCCESS     .NDX file opened
  4077.                     SC_MEMERR      memory allocation failure
  4078.                     SC_NOFILE      .NDX file not found
  4079.                     SC_RDFAIL      disk read failure
  4080.                     SC_NONDX       file not in .NDX format
  4081.                     SC_SKFAIL      disk seek failure
  4082.                     SC_NOHNDL      no SoftC handles available
  4083.                     SC_BADFNAME    invalid filename
  4084.  
  4085.  
  4086.                                          Chapter 7, The SoftC Library    71                                                                         71
  4087.  
  4088.  
  4089.           Example          Example          _______
  4090.  
  4091.           #include "SoftC.h"
  4092.           #include "dbase.h"
  4093.           
  4094.           void main()
  4095.           {
  4096.             char ndx;
  4097.           
  4098.             scinit(20,20);
  4099.             if (sciopen(&ndx,"UNKNOWN.NDX") == SC_SUCCESS) {
  4100.               sciclose(ndx);
  4101.             }
  4102.             scterm();
  4103.           }
  4104.  
  4105.  
  4106.  
  4107.  
  4108.  
  4109.           scipinfo          scipinfo          ________
  4110.  
  4111.  
  4112.  
  4113.  
  4114.           Usage          Usage          _____
  4115.                     signed short int scipinfo( signed char handle,                                     scipinfo                                                                                ______ 
  4116.                                                signed char *numpgs );
  4117.  
  4118.  
  4119.           Prototype in          Prototype in          ____________
  4120.                     dbase.h
  4121.  
  4122.  
  4123.           Description          Description          ___________
  4124.                     scipinfo gets  the maximum  number of  index pages  the                    scipinfo                                               
  4125.                     SoftC file  manager can  keep in  memory and returns it
  4126.                     via numpgs.
  4127.  
  4128.  
  4129.           Return Value          Return Value          ____________
  4130.                     SC_SUCCESS     max number of pages allowed returned
  4131.                     SC_BADHNDL     .NDX file not open or bad handle
  4132.  
  4133.  
  4134.           Example          Example          _______
  4135.  
  4136.           #include "SoftC.h"
  4137.           #include "dbase.h"
  4138.           #include "windows.h"
  4139.           
  4140.           void main()
  4141.           {
  4142.             char ndx, numpgs;
  4143.  
  4144.  
  4145.           72    Chapter 7, The SoftC Library          72                                
  4146.  
  4147.  
  4148.           
  4149.             scinit(20,20);
  4150.             if (sciopen(&ndx,"TEST.NDX") == SC_SUCCESS) {
  4151.               scipinfo(ndx,&numpgs) == SC_SUCCESS)
  4152.               scwprintf("Maximum number of pages = %d\n",numpgs);
  4153.               sciclose(ndx);
  4154.             }
  4155.             scterm();
  4156.           }
  4157.  
  4158.  
  4159.  
  4160.  
  4161.  
  4162.           scipnum          scipnum          _______
  4163.  
  4164.  
  4165.  
  4166.  
  4167.           Usage          Usage          _____
  4168.                     signed short int scipnum( signed char handle,                                     scipnum                                                                               ______ 
  4169.                                               signed char *numpgs );                                                           ______   
  4170.  
  4171.  
  4172.           Prototype in          Prototype in          ____________
  4173.                     dbase.h
  4174.  
  4175.  
  4176.           Description          Description          ___________
  4177.                     scipnum sets the maximum number of index pages (numpgs)                    scipnum                                                                                                                    ______ 
  4178.                     the SoftC  file manager  can keep in memory. Memory for
  4179.                     index pages will be freed or allocated as appropriate.
  4180.  
  4181.  
  4182.           Return Value          Return Value          ____________
  4183.                     SC_SUCCESS     new max number of pages allowed returned
  4184.                     SC_BADHNDL     .NDX file was open or bad handle
  4185.                     SC_BADCMD      invalid new number of pages requested
  4186.  
  4187.  
  4188.           Example          Example          _______
  4189.  
  4190.           #include "SoftC.h"
  4191.           #include "dbase.h"
  4192.           #include "windows.h"
  4193.           
  4194.           void main()
  4195.           {
  4196.             char ndx, numpgs = 5;
  4197.           
  4198.             scinit(20,20);
  4199.             if (sciopen(&ndx,"TEST.NDX") == SC_SUCCESS) {
  4200.               scipnum(ndx,&numpgs);
  4201.               scipinfo(ndx,&numpgs);
  4202.  
  4203.  
  4204.                                          Chapter 7, The SoftC Library    73                                                                         73
  4205.  
  4206.  
  4207.               scwprintf("New max = %d\n",numpgs);
  4208.               sciclose(ndx);
  4209.             }
  4210.             scterm();
  4211.           }
  4212.  
  4213.  
  4214.  
  4215.  
  4216.  
  4217.           scterm          scterm          ______
  4218.  
  4219.  
  4220.  
  4221.  
  4222.           Usage          Usage          _____
  4223.                     void scterm( void );                         scterm         
  4224.  
  4225.  
  4226.           Prototype in          Prototype in          ____________
  4227.                     SoftC.h
  4228.  
  4229.  
  4230.           Description          Description          ___________
  4231.                     scterm is called once at the end of the program. Memory                    scterm                                                 
  4232.                     allocated by  scinit for  internal  control  structures                                  scinit                                   
  4233.                     will be  freed. All  files and  windows  open  will  be
  4234.                     closed and any memory allocated for them will be freed.
  4235.  
  4236.  
  4237.           See also          See also          ________
  4238.                     scinit.                    scinit 
  4239.  
  4240.  
  4241.           Return Value          Return Value          ____________
  4242.                     SC_SUCCESS     completed initialization
  4243.  
  4244.  
  4245.           Example          Example          _______
  4246.  
  4247.           #include "SoftC.h"
  4248.           
  4249.           void main()
  4250.           {
  4251.             scinit(20,20);
  4252.             scterm();
  4253.           }
  4254.  
  4255.  
  4256.           74    Chapter 7, The SoftC Library          74                                
  4257.  
  4258.  
  4259.           scvers          scvers          ______
  4260.  
  4261.  
  4262.  
  4263.  
  4264.           Usage          Usage          _____
  4265.                     signed char * scvers( void );                                  scvers         
  4266.  
  4267.  
  4268.           Prototype in          Prototype in          ____________
  4269.                     SoftC.h
  4270.  
  4271.  
  4272.           Description          Description          ___________
  4273.                     scvers gets the SoftC library revision in the form of a                    scvers                                                 
  4274.                     character string.
  4275.  
  4276.  
  4277.           Return Value          Return Value          ____________
  4278.                     scvers returns the library revision.                    scvers                              
  4279.  
  4280.  
  4281.           Example          Example          _______
  4282.  
  4283.           #include "SoftC.h"
  4284.           #include "windows.h"
  4285.           
  4286.           void main()
  4287.           {
  4288.             scinit(20,20);
  4289.             scwprintf("SoftC Library Revision %s",scvers());
  4290.             scterm();
  4291.           }
  4292.  
  4293.  
  4294.  
  4295.  
  4296.  
  4297.           scwaget          scwaget          _______
  4298.  
  4299.  
  4300.  
  4301.  
  4302.           Usage          Usage          _____
  4303.                     void scwaget( unsigned char *foreground,                         scwaget                                                                             __________ 
  4304.                                   unsigned char *background );                                                 __________   
  4305.  
  4306.  
  4307.           Prototype in          Prototype in          ____________
  4308.                     windows.h
  4309.  
  4310.  
  4311.                                          Chapter 7, The SoftC Library    75                                                                         75
  4312.  
  4313.  
  4314.           Description          Description          ___________
  4315.                     scwaget gets the current text foreground and background                    scwaget                                                                                                  __________     __________
  4316.                     color attributes.
  4317.  
  4318.  
  4319.           See also          See also          ________
  4320.                     scwaput.                    scwaput 
  4321.  
  4322.  
  4323.           Return Value          Return Value          ____________
  4324.                     None.
  4325.  
  4326.  
  4327.           Example          Example          _______
  4328.  
  4329.           #include "SoftC.h"
  4330.           #include "windows.h"
  4331.           
  4332.           void main()
  4333.           {
  4334.             unsigned char foreground,background;
  4335.           
  4336.             scinit(20,20);
  4337.             scwaget(&foreground,&background);
  4338.             scwprintf("%d %d",foreground,background);
  4339.             scterm();
  4340.           }
  4341.  
  4342.  
  4343.  
  4344.  
  4345.  
  4346.           scwaput          scwaput          _______
  4347.  
  4348.  
  4349.  
  4350.  
  4351.           Usage          Usage          _____
  4352.                     void scwaput( unsigned char foreground,                         scwaput                                                                           __________ 
  4353.                                   unsigned char background );                                                __________   
  4354.  
  4355.  
  4356.           Prototype in          Prototype in          ____________
  4357.                     windows.h
  4358.  
  4359.  
  4360.           Description          Description          ___________
  4361.                     scwaput sets  the text  foreground and background color                    scwaput                                                                                            __________     __________      
  4362.                     attributes.
  4363.  
  4364.  
  4365.           See also          See also          ________
  4366.                     scwaget.                    scwaget 
  4367.  
  4368.  
  4369.           76    Chapter 7, The SoftC Library          76                                
  4370.  
  4371.  
  4372.           Return Value          Return Value          ____________
  4373.                     None.
  4374.  
  4375.  
  4376.           Example          Example          _______
  4377.  
  4378.           #include <conio.h>
  4379.           #include "SoftC.h"
  4380.           #include "windows.h"
  4381.           
  4382.           void main()
  4383.           {
  4384.             scinit(20,20);
  4385.           /* blinking yellow on black */
  4386.             scwaput(YELLOW + BLINK,BLACK);
  4387.             scwputs("Hello world!");
  4388.             scterm();
  4389.           }
  4390.  
  4391.  
  4392.  
  4393.  
  4394.  
  4395.           scwbget          scwbget          _______
  4396.  
  4397.  
  4398.  
  4399.  
  4400.           Usage          Usage          _____
  4401.                     signed short int scwbget( signed char offset,                                     scwbget                                                                               ______ 
  4402.                                               unsigned char *uplft,                                                                      _____          
  4403.                                               unsigned char *uprght,                                                             ______ 
  4404.                                               unsigned char *lowlft,                                                             ______ 
  4405.                                               unsigned char *lowrght,                                                             _______ 
  4406.                                               unsigned char *horiz,                                                             _____ 
  4407.                                               unsigned char *vert );                                                             ____   
  4408.  
  4409.  
  4410.           Prototype in          Prototype in          ____________
  4411.                     windows.h
  4412.  
  4413.  
  4414.           Description          Description          ___________
  4415.                     scwbget  is   used  to  retrieve  window  border  style                    scwbget                                                
  4416.                     information.
  4417.  
  4418.  
  4419.                     This is  where each  border character will be displayed
  4420.                     in relation  to the  other border  characters  of  this
  4421.                     style:
  4422.  
  4423.  
  4424.                                          Chapter 7, The SoftC Library    77                                                                         77
  4425.  
  4426.  
  4427.                     uplft     horiz     uprght
  4428.                     vert                vert
  4429.                     lowlft    horiz     lowrght
  4430.  
  4431.  
  4432.                     There are four (4) predefined border styles:
  4433.  
  4434.  
  4435.                     ┌───┐     ╔═══╗     ╒═══╕     ╓───╖
  4436.                     │ 0 │     ║ 1 ║     │ 2 │     ║ 3 ║
  4437.                     └───┘     ╚═══╝     ╘═══╛     ╙───╜
  4438.  
  4439.  
  4440.                     There is  only room  for four styles in the array, if a
  4441.                     different style  is desired  one of  the default styles
  4442.                     will have to be overwritten using scwbput.                                                      scwbput 
  4443.  
  4444.  
  4445.                     Border style zero (0) is the default style for scwopen.                                                                   scwopen 
  4446.                     The characters  found in style zero will always be used
  4447.                     by scwopen.  These characters  can easily be changed by                       scwopen                                             
  4448.                     scwbput                    scwbput
  4449.  
  4450.  
  4451.           See also          See also          ________
  4452.                     scwbput.                    scwbput 
  4453.  
  4454.  
  4455.           Return Value          Return Value          ____________
  4456.                     SC_SUCCESS     record recovered
  4457.                     SC_BADOFS      invalid border array offset
  4458.  
  4459.  
  4460.           Example          Example          _______
  4461.  
  4462.           #include "SoftC.h"
  4463.           #include "windows.h"
  4464.           
  4465.           void main()
  4466.           {
  4467.             unsigned char ul,ur,ll,lr,h,v;
  4468.           
  4469.             scinit(20,20);
  4470.           /* changes the default window border style */
  4471.             scwbget(3,&ul,&ur,&ll,&lr,&h,&v);
  4472.             scwbput(0,ul,ur,ll,lr,h,v);
  4473.             scterm();
  4474.           }
  4475.  
  4476.  
  4477.           78    Chapter 7, The SoftC Library          78                                
  4478.  
  4479.  
  4480.           scwbput          scwbput          _______
  4481.  
  4482.  
  4483.  
  4484.  
  4485.           Usage          Usage          _____
  4486.                     signed short int scwbput( signed char offset,                                     scwbput                                                                               ______ 
  4487.                                               unsigned char uplft,                                                                      _____           
  4488.                                               unsigned char uprght,                                                            ______ 
  4489.                                               unsigned char lowlft,                                                            ______ 
  4490.                                               unsigned char lowrght,                                                            _______ 
  4491.                                               unsigned char horiz,                                                            _____ 
  4492.                                               unsigned char vert );                                                            ____   
  4493.  
  4494.  
  4495.           Prototype in          Prototype in          ____________
  4496.                     windows.h
  4497.  
  4498.  
  4499.           Description          Description          ___________
  4500.                     scwbput is  used to redefine a window border style. The                    scwbput                                                
  4501.                     six characters to be used when drawing a window outline
  4502.                     are supplied along with an index into the window border
  4503.                     array.
  4504.  
  4505.  
  4506.                     This is  where each  character  will  be  displayed  in
  4507.                     relation to the other new border style characters:
  4508.  
  4509.  
  4510.                     uplft     horiz     uprght
  4511.                     vert                vert
  4512.                     lowlft    horiz     lowrght
  4513.  
  4514.  
  4515.           See also          See also          ________
  4516.                     scwbget.                    scwbget 
  4517.  
  4518.  
  4519.           Return Value          Return Value          ____________
  4520.                     SC_SUCCESS     record recovered
  4521.                     SC_BADOFS      invalid border array offset
  4522.  
  4523.  
  4524.           Example          Example          _______
  4525.  
  4526.           #include "SoftC.h"
  4527.           #include "windows.h"
  4528.           
  4529.           void main()
  4530.           {
  4531.             unsigned char ul,ur,ll,lr,h,v;
  4532.           
  4533.             scinit(20,20);
  4534.  
  4535.  
  4536.                                          Chapter 7, The SoftC Library    79                                                                         79
  4537.  
  4538.  
  4539.           /* changes the default window border style */
  4540.             scwbget(3,&ul,&ur,&ll,&lr,&h,&v);
  4541.             scwbput(0,ul,ur,ll,lr,h,v);
  4542.             scterm();
  4543.           }
  4544.  
  4545.  
  4546.  
  4547.  
  4548.  
  4549.           scwcget          scwcget          _______
  4550.  
  4551.  
  4552.  
  4553.  
  4554.           Usage          Usage          _____
  4555.                     signed short int scwcget( signed char offset,                                     scwcget                                                                               ______ 
  4556.                                               unsigned char *hfore,                                                                      _____          
  4557.                                               unsigned char *hback,                                                             _____ 
  4558.                                               unsigned char *bfore,                                                             _____ 
  4559.                                               unsigned char *bback,                                                             _____ 
  4560.                                               unsigned char *tfore,                                                             _____ 
  4561.                                               unsigned char *tback);                                                             _____  
  4562.  
  4563.  
  4564.           Prototype in          Prototype in          ____________
  4565.                     windows.h
  4566.  
  4567.  
  4568.           Description          Description          ___________
  4569.                     scwcget  is   used  to  retrieve  window  color  scheme                    scwcget                                                
  4570.                     information. Three  pairs of  color information will be
  4571.                     returned:  title   foreground  (hfore)  and  background                                                    _____                  
  4572.                     (hback),  border   foreground  (bfore)  and  background                     _____                          _____                  
  4573.                     (bback), and  text foreground  (tfore)  and  background                     _____                          _____                  
  4574.                     (tback) colors.                     _____         
  4575.  
  4576.  
  4577.                     There are ten (10) predefined window color schemes:
  4578.  
  4579.  
  4580.                     Scheme 0:
  4581.                     Title:    Light Gray on Blue.
  4582.                     Border:   Light Gray on Blue.
  4583.                     Text:     Light Gray on Blue.
  4584.  
  4585.  
  4586.                     Scheme 1:
  4587.                     Title:    Light Gray on Green.
  4588.                     Border:   Light Gray on Green.
  4589.                     Text:     Light Gray on Green.
  4590.  
  4591.  
  4592.           80    Chapter 7, The SoftC Library          80                                
  4593.  
  4594.  
  4595.                     Scheme 2:
  4596.                     Title:    Light Gray on Red.
  4597.                     Border:   Light Gray on Red.
  4598.                     Text:     Light Gray on Red.
  4599.  
  4600.  
  4601.                     Scheme 3:
  4602.                     Title:    White on Black.
  4603.                     Border:   White on Black.
  4604.                     Text:     White on Black.
  4605.  
  4606.  
  4607.                     Scheme 4:
  4608.                     Title:    Blue on Black.
  4609.                     Border:   Blue on Black.
  4610.                     Text:     Blue on Black.
  4611.  
  4612.  
  4613.                     Scheme 5:
  4614.                     Title:    Green on Black.
  4615.                     Border:   Green on Black.
  4616.                     Text:     Green on Black.
  4617.  
  4618.  
  4619.                     Scheme 6:
  4620.                     Title:    Cyan on Black.
  4621.                     Border:   Cyan on Black.
  4622.                     Text:     Cyan on Black.
  4623.  
  4624.  
  4625.                     Scheme 7:
  4626.                     Title:    Red on Black.
  4627.                     Border:   Red on Black.
  4628.                     Text:     Red on Black.
  4629.  
  4630.  
  4631.                     Scheme 8:
  4632.                     Title:    Magenta on Black.
  4633.                     Border:   Magenta on Black.
  4634.                     Text:     Magenta on Black.
  4635.  
  4636.  
  4637.                     Scheme 9:
  4638.                     Title:    Brown on Black.
  4639.                     Border:   Brown on Black.
  4640.                     Text:     Brown on Black.
  4641.  
  4642.  
  4643.                     If scinit  senses a monochrome monitor the entire color                       scinit                                              
  4644.                     table will be written to all yellow foreground on black
  4645.                     background.
  4646.  
  4647.  
  4648.                                          Chapter 7, The SoftC Library    81                                                                         81
  4649.  
  4650.  
  4651.                     There is  only room  for ten schemes in the array, if a
  4652.                     different one  is desired  one of  the default  schemes
  4653.                     will have to be overwritten using scwcput.                                                      scwcput 
  4654.  
  4655.  
  4656.                     Color  scheme  zero  (0)  is  the  default  scheme  for
  4657.                     scwopen. The colors found in scheme zero will always be                    scwopen                                                
  4658.                     used by  scwopen. These colors can easily be changed by                             scwopen                                       
  4659.                     scwcput.                    scwcput 
  4660.  
  4661.  
  4662.           See also          See also          ________
  4663.                     scwcput.                    scwcput 
  4664.  
  4665.  
  4666.           Return Value          Return Value          ____________
  4667.                     SC_SUCCESS     record recovered
  4668.                     SC_BADOFS      invalid border array offset
  4669.  
  4670.  
  4671.           Example          Example          _______
  4672.  
  4673.           #include "SoftC.h"
  4674.           #include "windows.h"
  4675.           
  4676.           void main()
  4677.           {
  4678.             unsigned char hf,hb,bf,bb,tf,tb;
  4679.           
  4680.             scinit(20,20);
  4681.           /* changes the default window color scheme */
  4682.             scwcget(3,&hf,&hb,&bf,&bb,&tf,&tb);
  4683.             scwcput(0,hf,hb,bf,bb,tf,tb);
  4684.             scterm();
  4685.           }
  4686.  
  4687.  
  4688.  
  4689.  
  4690.  
  4691.           scwclose          scwclose          ________
  4692.  
  4693.  
  4694.  
  4695.  
  4696.           Usage          Usage          _____
  4697.                     signed short int scwclose( signed char handle );                                     scwclose                                                                                  ______   
  4698.  
  4699.  
  4700.           Prototype in          Prototype in          ____________
  4701.                     windows.h
  4702.  
  4703.  
  4704.           82    Chapter 7, The SoftC Library          82                                
  4705.  
  4706.  
  4707.           Description          Description          ___________
  4708.                     scwclose closes a window and frees all allocated memory                    scwclose                                               
  4709.                     associated with  that window. Actual screen information
  4710.                     overlaid by window will be restored.
  4711.  
  4712.  
  4713.                     If the  window attempting  to be  closed is overlaid by
  4714.                     another window  the close  will be ignored and an error
  4715.                     will be returned.
  4716.  
  4717.  
  4718.                     If the  current window  is  being  closed,  the  window
  4719.                     opened (or  selected) just prior to this window will be
  4720.                     selected. If  no other  windows remain  to be selected,
  4721.                     the entire screen will be selected.
  4722.  
  4723.  
  4724.           See also          See also          ________
  4725.                     scwopen, scwopenx, scwselect.                    scwopen  scwopenx  scwselect 
  4726.  
  4727.  
  4728.           Return Value          Return Value          ____________
  4729.                     SC_SUCCESS     window file closed
  4730.                     SC_BADHNDL     invalid window handle
  4731.                     SC_WINOVRLAD   window is overlaid by another
  4732.  
  4733.  
  4734.           Example          Example          _______
  4735.  
  4736.           #include "SoftC.h"
  4737.           #include "windows.h"
  4738.           
  4739.           void main()
  4740.           {
  4741.             char win;
  4742.           
  4743.             scinit(20,20);
  4744.             if (scwopen(&win,5,5,20,1) == SC_SUCCESS) {
  4745.               scwputs("Hello world!");
  4746.               scwclose(win);
  4747.             }
  4748.             scterm();
  4749.           }
  4750.  
  4751.  
  4752.                                          Chapter 7, The SoftC Library    83                                                                         83
  4753.  
  4754.  
  4755.           scwclr          scwclr          ______
  4756.  
  4757.  
  4758.  
  4759.  
  4760.           Usage          Usage          _____
  4761.                     void scwclr( void );                         scwclr         
  4762.  
  4763.  
  4764.           Prototype in          Prototype in          ____________
  4765.                     windows.h
  4766.  
  4767.  
  4768.           Description          Description          ___________
  4769.                     scwclr clears  the currently selected window (or, if no                    scwclr                                                 
  4770.                     windows are  open, the  entire screen). The cursor will
  4771.                     be moved  to  the  upper  left  corner  of  the  window
  4772.                     (screen).
  4773.  
  4774.  
  4775.           See also          See also          ________
  4776.                     scwclreol.                    scwclreol 
  4777.  
  4778.  
  4779.           Return Value          Return Value          ____________
  4780.                     None.
  4781.  
  4782.  
  4783.           Example          Example          _______
  4784.  
  4785.           #include "SoftC.h"
  4786.           #include "windows.h"
  4787.           
  4788.           void main()
  4789.           {
  4790.             scinit(20,20);
  4791.             scwclr();
  4792.             scwputs("Hello world!");
  4793.             scterm();
  4794.           }
  4795.  
  4796.  
  4797.  
  4798.  
  4799.  
  4800.           scwclreol          scwclreol          _________
  4801.  
  4802.  
  4803.  
  4804.  
  4805.           Usage          Usage          _____
  4806.                     void scwclreol( void );                         scwclreol         
  4807.  
  4808.  
  4809.           84    Chapter 7, The SoftC Library          84                                
  4810.  
  4811.  
  4812.           Prototype in          Prototype in          ____________
  4813.                     windows.h
  4814.  
  4815.  
  4816.           Description          Description          ___________
  4817.                     scwclreol clears  from the  current cursor  position to                    scwclreol                                              
  4818.                     the end  of the  current line.  If a window is open, it
  4819.                     will clear  to the  edge of the window. The cursor will
  4820.                     not be advanced.
  4821.  
  4822.  
  4823.           See also          See also          ________
  4824.                     scwclr.                    scwclr 
  4825.  
  4826.  
  4827.           Return Value          Return Value          ____________
  4828.                     None.
  4829.  
  4830.  
  4831.           Example          Example          _______
  4832.  
  4833.           #include "SoftC.h"
  4834.           #include "windows.h"
  4835.           
  4836.           void main()
  4837.           {
  4838.             scinit(20,20);
  4839.             scwputs("Hello world!");
  4840.             scwgoto(6,1);
  4841.             scwclreol();
  4842.             scterm();
  4843.           }
  4844.  
  4845.  
  4846.  
  4847.  
  4848.  
  4849.           scwcput          scwcput          _______
  4850.  
  4851.  
  4852.  
  4853.  
  4854.           Usage          Usage          _____
  4855.                     signed short int scwcput( signed char offset,                                     scwcput                                                                               ______ 
  4856.                                               unsigned char hfore,                                                            _____ 
  4857.                                               unsigned char hback,                                                            _____ 
  4858.                                               unsigned char bfore,                                                            _____ 
  4859.                                               unsigned char bback,                                                            _____ 
  4860.                                               unsigned char tfore,                                                            _____ 
  4861.                                               unsigned char tback);                                                            _____  
  4862.  
  4863.  
  4864.           Prototype in          Prototype in          ____________
  4865.                     windows.h
  4866.  
  4867.  
  4868.                                          Chapter 7, The SoftC Library    85                                                                         85
  4869.  
  4870.  
  4871.           Description          Description          ___________
  4872.                     scwcput is  used to  redefine a  window  color  scheme.                    scwcput                                                
  4873.                     Three pairs  of color  information  will  be  returned:
  4874.                     title foreground (hfore) and background (hback), border                                      _____                  _____         
  4875.                     foreground (bfore)  and background  (bback),  and  text                                _____                    _____             
  4876.                     foreground (tfore) and background (tback) colors.                                _____                  _____         
  4877.  
  4878.  
  4879.           See also          See also          ________
  4880.                     scwcget.                    scwcget 
  4881.  
  4882.  
  4883.           Return Value          Return Value          ____________
  4884.                     SC_SUCCESS     record recovered
  4885.                     SC_BADOFS      invalid border array offset
  4886.  
  4887.  
  4888.           Example          Example          _______
  4889.  
  4890.           #include "SoftC.h"
  4891.           #include "windows.h"
  4892.           
  4893.           void main()
  4894.           {
  4895.             unsigned char ul,ur,ll,lr,h,v;
  4896.           
  4897.             scinit(20,20);
  4898.           /* changes the default window color scheme */
  4899.             scwcget(3,&hf,&hb,&bf,&bb,&tf,&tb);
  4900.             scwcput(0,hf,hb,bf,bb,tf,tb);
  4901.             scterm();
  4902.           }
  4903.  
  4904.  
  4905.  
  4906.  
  4907.  
  4908.           scwcursoff          scwcursoff          __________
  4909.  
  4910.  
  4911.  
  4912.  
  4913.           Usage          Usage          _____
  4914.                     void scwcursoff( void );                         scwcursoff         
  4915.  
  4916.  
  4917.           Prototype in          Prototype in          ____________
  4918.                     windows.h
  4919.  
  4920.  
  4921.           Description          Description          ___________
  4922.                     scwcursoff will  turn off  the blinking cursor. It does                    scwcursoff                                             
  4923.                     not affect  the cursor  positioning (scwgoto) or any of                                                         scwgoto           
  4924.                     the window printing functions.
  4925.  
  4926.  
  4927.           86    Chapter 7, The SoftC Library          86                                
  4928.  
  4929.  
  4930.           See also          See also          ________
  4931.                     scwcurson.                    scwcurson 
  4932.  
  4933.  
  4934.           Return Value          Return Value          ____________
  4935.                     None.
  4936.  
  4937.  
  4938.           Example          Example          _______
  4939.  
  4940.           #include "SoftC.h"
  4941.           #include "windows.h"
  4942.           
  4943.           void main()
  4944.           {
  4945.             scinit(1,1);
  4946.             scwcursoff();
  4947.             scwprintf("Hello");
  4948.             scwcurson();
  4949.             scterm();
  4950.           }
  4951.  
  4952.  
  4953.  
  4954.  
  4955.  
  4956.           scwcurso          scwcurso          ________
  4957.  
  4958.  
  4959.  
  4960.  
  4961.           Usage          Usage          _____
  4962.                     void scwcurson( void );                         scwcurson         
  4963.  
  4964.  
  4965.           Prototype in          Prototype in          ____________
  4966.                     windows.h
  4967.  
  4968.  
  4969.           Description          Description          ___________
  4970.                     scwcurson will turn on the blinking cursor. It does not                    scwcurson                                              
  4971.                     affect the  cursor positioning  (scwgoto) or any of the                                                     scwgoto               
  4972.                     window printing functions.
  4973.  
  4974.  
  4975.           See also          See also          ________
  4976.                     scwcursoff.                    scwcursoff 
  4977.  
  4978.  
  4979.           Return Value          Return Value          ____________
  4980.                     None.
  4981.  
  4982.  
  4983.                                          Chapter 7, The SoftC Library    87                                                                         87
  4984.  
  4985.  
  4986.           Example          Example          _______
  4987.  
  4988.           #include "SoftC.h"
  4989.           #include "windows.h"
  4990.           
  4991.           void main()
  4992.           {
  4993.             scinit(1,1);
  4994.             scwcursoff();
  4995.             scwprintf("Hello");
  4996.             scwcurson();
  4997.             scterm();
  4998.           }
  4999.  
  5000.  
  5001.  
  5002.  
  5003.  
  5004.           scwgoto          scwgoto          _______
  5005.  
  5006.  
  5007.  
  5008.  
  5009.           Usage          Usage          _____
  5010.                     signed short int scwgoto( unsigned short int x,                                     scwgoto                                                                                        _ 
  5011.                                               unsigned short int y );                                                                 _   
  5012.  
  5013.  
  5014.           Prototype in          Prototype in          ____________
  5015.                     windows.h
  5016.  
  5017.  
  5018.           Description          Description          ___________
  5019.                     scwgoto moves the cursor to the desired position within                    scwgoto                                                
  5020.                     the current  window (or screen if no windows are open).
  5021.                     If  the  coordinates  are  invalid  the  call  will  be
  5022.                     ignored.
  5023.  
  5024.  
  5025.                     The upper  left corner  of the  window is column 1 (x),                                                                        _  
  5026.                     row 1 (y).                           _  
  5027.  
  5028.  
  5029.           See also          See also          ________
  5030.                     scwxloc, scwyloc.                    scwxloc  scwyloc 
  5031.  
  5032.  
  5033.           Return Value          Return Value          ____________
  5034.                     SC_SUCCESS     record recovered
  5035.                     SC_BADCOORDS   invalid window coordinates
  5036.  
  5037.  
  5038.           88    Chapter 7, The SoftC Library          88                                
  5039.  
  5040.  
  5041.           Example          Example          _______
  5042.  
  5043.           #include "SoftC.h"
  5044.           #include "windows.h"
  5045.           
  5046.           void main()
  5047.           {
  5048.           
  5049.             scinit(20,20);
  5050.             scwgoto(10,20);
  5051.             scterm();
  5052.           }
  5053.  
  5054.  
  5055.  
  5056.  
  5057.  
  5058.           scwinfo          scwinfo          _______
  5059.  
  5060.  
  5061.  
  5062.  
  5063.           Usage          Usage          _____
  5064.                     signed short int scwinfo( signed char handle,                                     scwinfo                                                                               ______ 
  5065.                                               unsigned short int *left,                                                                  ____ 
  5066.                                               unsigned short int *top,                                                                  ___ 
  5067.                                               unsigned short int *width,                                                                  _____ 
  5068.                                               unsigned short int *height,                                                                  ______ 
  5069.                                               signed char *hlen,                                                           ____ 
  5070.                                               signed char *color,                                                           _____ 
  5071.                                               signed char *border );                                                           ______   
  5072.  
  5073.  
  5074.           Prototype in          Prototype in          ____________
  5075.                     windows.h
  5076.  
  5077.  
  5078.           Description          Description          ___________
  5079.                     scwinfo returns the parameters used to open the window.                    scwinfo                                                
  5080.                     The coordinates  of the  upper left  hand corner of the
  5081.                     window (left, top), the width and height of the window,                            ____  ___       _____     ______               
  5082.                     the window  title length (hlen), color scheme (color is                                              ____                 _____   
  5083.                     an index into the color scheme table), and border style
  5084.                     (border is  an index  into the border style table) will                     ______                                                
  5085.                     be returned.
  5086.  
  5087.  
  5088.           See also          See also          ________
  5089.                     scwopen, scwopenx.                    scwopen  scwopenx 
  5090.  
  5091.  
  5092.           Return Value          Return Value          ____________
  5093.                     SC_SUCCESS     window opened and memory allocated
  5094.                     SC_BADHNDL     too many open windows
  5095.  
  5096.  
  5097.                                          Chapter 7, The SoftC Library    89                                                                         89
  5098.  
  5099.  
  5100.           Example          Example          _______
  5101.  
  5102.           #include "SoftC.h"
  5103.           #include "windows.h"
  5104.           
  5105.           void main()
  5106.           {
  5107.             char win,hdrl,b,c;
  5108.             int l,t,w,h;
  5109.           
  5110.             scinit(20,20);
  5111.             scwopenx(&win,5,5,20,1,NULL,3,-1);
  5112.             scwinfo(win,&l,&t,&w,&h,hdrl,&b,&c);
  5113.             scwprintf("%u %u %u %u %d %d %d",
  5114.                     l,t,w,h,hdrl,b,c);
  5115.             scwclose(win);
  5116.             scterm();
  5117.           }
  5118.  
  5119.  
  5120.  
  5121.  
  5122.  
  5123.           scwopen          scwopen          _______
  5124.  
  5125.  
  5126.  
  5127.  
  5128.           Usage          Usage          _____
  5129.                     signed short int scwopen( signed char *handle,                                     scwopen                                                                                 ______ 
  5130.                                               unsigned short int left,                                                                 ____ 
  5131.                                               unsigned short int top,                                                                 ___ 
  5132.                                               unsigned short int width,                                                                 _____ 
  5133.                                               unsigned short int height );                                                                 ______   
  5134.  
  5135.  
  5136.           Prototype in          Prototype in          ____________
  5137.                     windows.h
  5138.  
  5139.  
  5140.           Description          Description          ___________
  5141.                     scwopen opens  a window  on the  screen. Memory will be                    scwopen                                                
  5142.                     allocated for  a window  packet and screen image buffer
  5143.                     for use internally by the SoftC window manager.
  5144.  
  5145.  
  5146.                     The window  border will  be drawn  using  border  style
  5147.                     zero. The  colors used in the window will be defined by
  5148.                     color style  zero. The  window will  be cleared and the
  5149.                     cursor moved  to the upper left corner (of the window).
  5150.                     Upon exit the new window will be the current window.
  5151.  
  5152.  
  5153.           90    Chapter 7, The SoftC Library          90                                
  5154.  
  5155.  
  5156.                     A copy  of the  original screen  overlaid  by  the  new
  5157.                     window will be kept.
  5158.  
  5159.  
  5160.           See also          See also          ________
  5161.                     scwclose, scwbget, scwcget.                    scwclose  scwbget  scwcget 
  5162.  
  5163.  
  5164.           Return Value          Return Value          ____________
  5165.                     SC_SUCCESS     window opened and memory allocated
  5166.                     SC_MEMERR      memory allocation failure
  5167.                     SC_BADCOORDS   invalid screen coordinates
  5168.                     SC_NOHNDL      too many open windows
  5169.                     SC_BADOFS      invalid color or border array offset
  5170.  
  5171.  
  5172.           Example          Example          _______
  5173.  
  5174.           #include "SoftC.h"
  5175.           #include "windows.h"
  5176.           
  5177.           void main()
  5178.           {
  5179.             char win;
  5180.           
  5181.             scinit(20,20);
  5182.             if (scwopen(&win,5,5,20,1) == SC_SUCCESS) {
  5183.               scwputs("Hello world!");
  5184.               scwclose(win);
  5185.             }
  5186.             scterm();
  5187.           }
  5188.  
  5189.  
  5190.  
  5191.  
  5192.  
  5193.           scwopenx          scwopenx          ________
  5194.  
  5195.  
  5196.  
  5197.  
  5198.           Usage          Usage          _____
  5199.                     signed short int scwopenx( signed char *handle,                                     scwopenx                                                                                  ______ 
  5200.                                                unsigned short int left,                                                                  ____ 
  5201.                                                unsigned short int top,                                                                  ___ 
  5202.                                                unsigned short int width,                                                                  _____ 
  5203.                                                unsigned short int height,                                                                  ______ 
  5204.                                                signed char *header,                                                            ______ 
  5205.                                                signed char color,                                                           _____ 
  5206.                                                signed char border );                                                           ______   
  5207.  
  5208.  
  5209.                                          Chapter 7, The SoftC Library    91                                                                         91
  5210.  
  5211.  
  5212.           Prototype in          Prototype in          ____________
  5213.                     windows.h
  5214.  
  5215.  
  5216.           Description          Description          ___________
  5217.                     scwopenx  is  an  extended  version  of  scwopen.  This                    scwopenx                                 scwopen       
  5218.                     function allows  the user  to specify  a  window  title
  5219.                     (header) and gives control over window colors (color is                     ______                                        _____   
  5220.                     an index into the window color table) and border styles
  5221.                     (border is an index into the border style table).                     ______                                          
  5222.  
  5223.  
  5224.                     One option  available under  .i.scwopenx; is to specify
  5225.                     that no  window border  should be  drawn when opening a
  5226.                     window. By  using a  minus  one  (-1)  for  the  border                                                                     ______
  5227.                     parameter a borderless window will be opened.
  5228.  
  5229.  
  5230.           See also          See also          ________
  5231.                     scwopen.                    scwopen 
  5232.  
  5233.  
  5234.           Return Value          Return Value          ____________
  5235.                     SC_SUCCESS     window opened and memory allocated
  5236.                     SC_MEMERR      memory allocation failure
  5237.                     SC_BADCOORDS   invalid screen coordinates
  5238.                     SC_NOHNDL      too many open windows
  5239.                     SC_BADOFS      invalid color or border array offset
  5240.  
  5241.  
  5242.           Example          Example          _______
  5243.  
  5244.           #include "SoftC.h"
  5245.           #include "windows.h"
  5246.           
  5247.           void main()
  5248.           {
  5249.             char win;
  5250.           
  5251.             scinit(20,20);
  5252.           /* open a window with no border */
  5253.             if (scwopenx(&win,5,5,20,1,NULL,3,-1) == SC_SUCCESS) {
  5254.               scwputs("Hello world!");
  5255.               scwclose(win);
  5256.             }
  5257.             scterm();
  5258.           }
  5259.  
  5260.  
  5261.           92    Chapter 7, The SoftC Library          92                                
  5262.  
  5263.  
  5264.           scwprintf          scwprintf          _________
  5265.  
  5266.  
  5267.  
  5268.  
  5269.           Usage          Usage          _____
  5270.                     void scwprintf( signed char *format[, argument, ...] );                         scwprintf                                                                                          ______   ________         
  5271.  
  5272.  
  5273.           Prototype in          Prototype in          ____________
  5274.                     windows.h
  5275.  
  5276.  
  5277.           Description          Description          ___________
  5278.                     scwprintf functions  the same  as the  printf  function                    scwprintf                              printf          
  5279.                     found in  your compiler. It accepts an optional  series
  5280.                     of arguments  (argument),  applies  to  each  a  format                                   ________                                
  5281.                     specification found in the string pointed to by format,                                                                    ______ 
  5282.                     and outputs  the formatted  data to  an  internal  data
  5283.                     buffer. This  data buffer is then output to the current
  5284.                     window. See  the description of printf in your compiler                                                    printf                 
  5285.                     manual for  more information. Note that if no window is
  5286.                     open the  text string  will be  output to  the  current
  5287.                     cursor position on the screen.
  5288.  
  5289.  
  5290.                     Because this  function uses  sprintf to  first build an                                                 sprintf                   
  5291.                     output string  in an internal data buffer, care must be
  5292.                     exercised by  the user  to supply  a format  descriptor                                                         ______            
  5293.                     which when  processed will result in a string no longer
  5294.                     than 256 characters (including terminating NULL bytes).
  5295.  
  5296.  
  5297.                     The cursor position will be updated.
  5298.  
  5299.  
  5300.                     Any newline  (\n) characters  found in  string will  be
  5301.                     translated into  a carriage  return -  line feed (\r\n)
  5302.                     sequence.
  5303.  
  5304.  
  5305.           See also          See also          ________
  5306.                     scwputc, scwputs.                    scwputc  scwputs 
  5307.  
  5308.  
  5309.           Return Value          Return Value          ____________
  5310.                     None.
  5311.  
  5312.  
  5313.           Example          Example          _______
  5314.  
  5315.           #include "SoftC.h"
  5316.           #include "windows.h"
  5317.           
  5318.  
  5319.  
  5320.                                          Chapter 7, The SoftC Library    93                                                                         93
  5321.  
  5322.  
  5323.           void main()
  5324.           {
  5325.           
  5326.             scinit(20,20);
  5327.             scwprintf("Hello world!");
  5328.             scterm();
  5329.           }
  5330.  
  5331.  
  5332.  
  5333.  
  5334.  
  5335.           scwputc          scwputc          _______
  5336.  
  5337.  
  5338.  
  5339.  
  5340.           Usage          Usage          _____
  5341.                     void scwputc( signed char ch );                         scwputc                                                                 __   
  5342.  
  5343.  
  5344.           Prototype in          Prototype in          ____________
  5345.                     windows.h
  5346.  
  5347.  
  5348.           Description          Description          ___________
  5349.                     scwputc will  put a single character out to the current                    scwputc                                                
  5350.                     window. The cursor position will be updated.
  5351.  
  5352.  
  5353.                     The  newline   (\n)  character  is  translated  into  a
  5354.                     carriage return - line feed (\r\n) sequence.
  5355.  
  5356.  
  5357.                     scwputc is implemented as a macro:                    scwputc                           
  5358.                          scwprintf("%c",ch);                         scwprintf          
  5359.  
  5360.  
  5361.           See also          See also          ________
  5362.                     scwprintf, scwputs.                    scwprintf  scwputs 
  5363.  
  5364.  
  5365.           Return Value          Return Value          ____________
  5366.                     None.
  5367.  
  5368.  
  5369.           Example          Example          _______
  5370.  
  5371.           #include "SoftC.h"
  5372.           #include "windows.h"
  5373.           
  5374.           void main()
  5375.           {
  5376.           
  5377.  
  5378.  
  5379.           94    Chapter 7, The SoftC Library          94                                
  5380.  
  5381.  
  5382.             scinit(20,20);
  5383.             scwputc('H');
  5384.             scterm();
  5385.           }
  5386.  
  5387.  
  5388.  
  5389.  
  5390.  
  5391.           scwputs          scwputs          _______
  5392.  
  5393.  
  5394.  
  5395.  
  5396.           Usage          Usage          _____
  5397.                     void scwputs( signed char *string );                         scwputs                                                                       ______   
  5398.  
  5399.  
  5400.           Prototype in          Prototype in          ____________
  5401.                     windows.h
  5402.  
  5403.  
  5404.           Description          Description          ___________
  5405.                     scwputs will  put a  NULL terminated  string out to the                    scwputs                                                                                                          ______           
  5406.                     current window. The cursor position will be updated.
  5407.  
  5408.  
  5409.                     Unlike most  compiler's puts  functions, a newline (\n)                                            puts                           
  5410.                     character is not appended to string.
  5411.  
  5412.  
  5413.                     Any  newline   characters  found   in  string  will  be
  5414.                     translated into  a carriage  return -  line feed (\r\n)
  5415.                     sequence.
  5416.  
  5417.  
  5418.                     scwputs is implemented as a macro:                    scwputs                           
  5419.                          scwprintf("%s",string);                         scwprintf              
  5420.  
  5421.  
  5422.           See also          See also          ________
  5423.                     scwprintf, scwputc.                    scwprintf  scwputc 
  5424.  
  5425.  
  5426.           Return Value          Return Value          ____________
  5427.                     None.
  5428.  
  5429.  
  5430.           Example          Example          _______
  5431.  
  5432.           #include "SoftC.h"
  5433.           #include "windows.h"
  5434.           
  5435.           void main()
  5436.  
  5437.  
  5438.                                          Chapter 7, The SoftC Library    95                                                                         95
  5439.  
  5440.  
  5441.           {
  5442.           
  5443.             scinit(20,20);
  5444.             scwputs("Hello world!");
  5445.             scterm();
  5446.           }
  5447.  
  5448.  
  5449.  
  5450.  
  5451.  
  5452.           scwselect          scwselect          _________
  5453.  
  5454.  
  5455.  
  5456.  
  5457.           Usage          Usage          _____
  5458.                     unsigned short int scwselect( signed char handle );                                       scwselect                                                                                     ______   
  5459.  
  5460.  
  5461.           Prototype in          Prototype in          ____________
  5462.                     windows.h
  5463.  
  5464.  
  5465.           Description          Description          ___________
  5466.                     scwselect makes  the window  specified  by  handle  the                    scwselect                                                                                                              ______     
  5467.                     current window.  The current cursor x,y position in the
  5468.                     previously selected  window will  be saved.  The window
  5469.                     specified by  handle is  selected  and  the  cursor  is
  5470.                     restored to its previous location.
  5471.  
  5472.  
  5473.                     Note that  if the  window attempting  to be selected is
  5474.                     overlaid by another window the call will be ignored.
  5475.  
  5476.  
  5477.           See also          See also          ________
  5478.                     scwopen.                    scwopen 
  5479.  
  5480.  
  5481.           Return Value          Return Value          ____________
  5482.                     SC_SUCCESS     window selected
  5483.                     SC_BADHNDL     invalid window handle
  5484.                     SC_WINOVRLAD   window is overlaid by another
  5485.  
  5486.  
  5487.           Example          Example          _______
  5488.  
  5489.           #include "SoftC.h"
  5490.           #include "windows.h"
  5491.           
  5492.           void main()
  5493.           {
  5494.             signed char win, win2;
  5495.  
  5496.  
  5497.           96    Chapter 7, The SoftC Library          96                                
  5498.  
  5499.  
  5500.           
  5501.             scinit(20,20);
  5502.             scwopenx(&win,5,5,20,2,"Window One",0,0);
  5503.             scwputs("Hello world!");
  5504.             scwopenx(&win2,1,10,60,5,"Window Two",1,1);
  5505.             scwputs("Hello world!");
  5506.             scwselect(win);
  5507.             scwputs("I am back.");
  5508.             scwclose(win);
  5509.             scwclose(win2);
  5510.             scterm();
  5511.           }
  5512.  
  5513.  
  5514.  
  5515.  
  5516.  
  5517.           scwtget          scwtget          _______
  5518.  
  5519.  
  5520.  
  5521.  
  5522.           Usage          Usage          _____
  5523.                     signed short int scwtget( signed char *header );                                     scwtget                                                                                   ______   
  5524.  
  5525.  
  5526.           Prototype in          Prototype in          ____________
  5527.                     windows.h
  5528.  
  5529.  
  5530.           Description          Description          ___________
  5531.                     scwtget is  used to  get the title text string from the                    scwtget                                                
  5532.                     current window.  scwinfo can be used to find the length                                     scwinfo                               
  5533.                     of the  window title string. A NULL will be returned in
  5534.                     header if  there is no title or the length of the title                    ______                                                 
  5535.                     is zero.
  5536.  
  5537.  
  5538.           See also          See also          ________
  5539.                     scwtput.                    scwtput 
  5540.  
  5541.  
  5542.           Return Value          Return Value          ____________
  5543.                     SC_SUCCESS     record recovered
  5544.                     SC_BADHDNL     no window is open
  5545.  
  5546.  
  5547.           Example          Example          _______
  5548.  
  5549.           #include "SoftC.h"
  5550.           #include "windows.h"
  5551.           
  5552.           void main()
  5553.           {
  5554.  
  5555.  
  5556.                                          Chapter 7, The SoftC Library    97                                                                         97
  5557.  
  5558.  
  5559.             char win, h[81];
  5560.           
  5561.             scinit(20,20);
  5562.             scwopenx(&win,2,2,20,5,"Title",0,0);
  5563.             scwtget(&h);
  5564.             scwputs(h);
  5565.             scwclose(win);
  5566.             scterm();
  5567.           }
  5568.  
  5569.  
  5570.  
  5571.  
  5572.  
  5573.           scwtput          scwtput          _______
  5574.  
  5575.  
  5576.  
  5577.  
  5578.           Usage          Usage          _____
  5579.                     signed short int scwtput( signed char *header);                                     scwtput                                                                                  ______  
  5580.  
  5581.  
  5582.           Prototype in          Prototype in          ____________
  5583.                     windows.h
  5584.  
  5585.  
  5586.           Description          Description          ___________
  5587.                     scwtput is  used to write a new title on an the current                    scwtput                                                
  5588.                     window. Memory  will be  allocated for  the  new  title
  5589.                     message and the old title will be freed.
  5590.  
  5591.  
  5592.           See also          See also          ________
  5593.                     scwtget.                    scwtget 
  5594.  
  5595.  
  5596.           Return Value          Return Value          ____________
  5597.                     SC_SUCCESS     record recovered
  5598.                     SC_BADHNDL     no window is open
  5599.                     SC_MEMERR      memory allocation failure
  5600.  
  5601.  
  5602.           Example          Example          _______
  5603.  
  5604.           #include "SoftC.h"
  5605.           #include "windows.h"
  5606.           
  5607.           void main()
  5608.           {
  5609.             char win;
  5610.           
  5611.             scinit(20,20);
  5612.             scwopenx(&win,2,2,20,5,"Title",0,0);
  5613.  
  5614.  
  5615.           98    Chapter 7, The SoftC Library          98                                
  5616.  
  5617.  
  5618.             scwtput("Header");
  5619.             scwclose(win);
  5620.             scterm();
  5621.           }
  5622.  
  5623.  
  5624.  
  5625.  
  5626.  
  5627.           scwxloc          scwxloc          _______
  5628.  
  5629.  
  5630.  
  5631.  
  5632.           Usage          Usage          _____
  5633.                     unsigned short int scwxloc( void );                                       scwxloc         
  5634.  
  5635.  
  5636.           Prototype in          Prototype in          ____________
  5637.                     windows.h
  5638.  
  5639.  
  5640.           Description          Description          ___________
  5641.                     scwxloc returns the x coordinate (column number) of the                    scwxloc                                                
  5642.                     current cursor position within the selected window.
  5643.  
  5644.  
  5645.           See also          See also          ________
  5646.                     scwgoto, scwyloc.                    scwgoto  scwyloc 
  5647.  
  5648.  
  5649.           Return Value          Return Value          ____________
  5650.                     None.
  5651.  
  5652.  
  5653.           Example          Example          _______
  5654.  
  5655.           #include "SoftC.h"
  5656.           #include "windows.h"
  5657.           
  5658.           void main()
  5659.           {
  5660.             unsigned short int x,y;
  5661.           
  5662.             scinit(20,20);
  5663.             scwputs("Hello world!");
  5664.             x = scwxloc();
  5665.             y = scwyloc();
  5666.             scwgoto(1,1);
  5667.             scwprintf("%d %d",x,y);
  5668.             scterm();
  5669.           }
  5670.  
  5671.  
  5672.                                          Chapter 7, The SoftC Library    99                                                                         99
  5673.  
  5674.  
  5675.           scwyloc          scwyloc          _______
  5676.  
  5677.  
  5678.  
  5679.  
  5680.           Usage          Usage          _____
  5681.                     unsigned short int scwyloc( void );                                       scwyloc         
  5682.  
  5683.  
  5684.           Prototype in          Prototype in          ____________
  5685.                     windows.h
  5686.  
  5687.  
  5688.           Description          Description          ___________
  5689.                     scwyloc returns  the y  coordinate (row  number) of the                    scwyloc                                                
  5690.                     current cursor position within the selected window.
  5691.  
  5692.  
  5693.           See also          See also          ________
  5694.                     scwgoto, scwxloc.                    scwgoto  scwxloc 
  5695.  
  5696.  
  5697.           Return Value          Return Value          ____________
  5698.                     None.
  5699.  
  5700.  
  5701.           Example          Example          _______
  5702.  
  5703.           #include "SoftC.h"
  5704.           #include "windows.h"
  5705.           
  5706.           void main()
  5707.           {
  5708.             unsigned short int x,y;
  5709.           
  5710.             scinit(20,20);
  5711.             scwputs("Hello world!");
  5712.             x = scwxloc();
  5713.             y = scwyloc();
  5714.             scwgoto(1,1);
  5715.             scwprintf("%d %d",x,y);
  5716.             scterm();
  5717.           }
  5718.  
  5719.  
  5720.                                        INDEX
  5721.  
  5722.  
  5723.             dtoc  16, 64, 65                                            scikmake  16, 54, 64, 65,
  5724.             left  16, 64, 65                                                66
  5725.             right  16, 65                                            sciknext  15, 67
  5726.             sccday  17, 21, 28                                            scikprev  15, 68
  5727.             sccddiff  17, 22                                            scinit  3, 5, 18, 69, 73,
  5728.             sccdn2s  17, 22, 23, 24                                                80
  5729.             sccds2n  17, 23, 24                                            sciopen  15, 56, 70
  5730.             sccdvalid  17, 22, 23, 25                                            scipinfo  15, 71
  5731.             sccdxlat  17, 22, 25, 26                                            scipnum  15, 72
  5732.             sccleap  17, 26, 27, 28                                            scterm  5, 13, 18, 70, 73
  5733.             sccleapi  17, 27                                            scvers  18, 74
  5734.             sccmonth  17, 21, 28                                            scwaget  8, 9, 74, 75
  5735.             scdclose  13, 15, 29                                            scwaput  8, 9, 75
  5736.             scdcreate  13, 14, 30                                            scwbget  10, 76, 78, 90
  5737.             scdfget  14, 32, 33, 34,                                            scwbput  10, 77, 78
  5738.                 37, 39, 45                                            scwcget  10, 79, 85, 90
  5739.             scdfgets  14, 32, 33, 38,                                            scwclose  9, 81, 82, 90
  5740.                 39                                            scwclr  8, 9, 83, 84
  5741.             scdfinfo  32, 33, 34, 35                                            scwclreol  8, 9, 83, 84
  5742.             scdfnam2no  15, 36                                            scwcput  10, 81, 84, 85
  5743.             scdfput  14, 32, 37, 39, 47                                            scwcursoff  8, 85, 86
  5744.             scdfputs  14, 34, 37, 38,                                            scwcurson  8, 86
  5745.                 39, 45, 47                                            scwgoto  8, 85, 86, 87, 98,
  5746.             scdinfo  13, 39, 40                                                99
  5747.             scdopen  13, 29, 40, 41                                            scwinfo  8, 10, 88, 96
  5748.             scdrclear  14, 41, 42                                            scwopen  9, 77, 81, 82, 88,
  5749.             scdrcopy  14, 42, 43                                                89, 91, 95
  5750.             scdrdel  14, 43, 44, 48                                            scwopenx  9, 82, 88, 90, 91
  5751.             scdrget  13, 32, 34, 44,                                            scwprintf  7, 8, 92, 93, 94
  5752.                 45, 47                                            scwputc  7, 8, 92, 93, 94
  5753.             scdrinfo  14, 35, 46                                            scwputs  7, 8, 9, 18, 92,
  5754.             scdrput  13, 47                                                93, 94
  5755.             scdrundel  14, 44, 48                                            scwselect  9, 82, 95
  5756.             scdsize  13, 49                                            scwtget  10, 96, 97
  5757.             sceclr  18, 50, 52                                            scwtput  10, 96, 97
  5758.             scemsg  18, 50, 51, 52                                            scwxloc  8, 87, 98, 99
  5759.             sciclose  52                                            scwyloc  8, 87, 98, 99
  5760.             scicreate  15, 53, 54, 66                                            sc_code  18, 19, 50
  5761.             sciexpr  15, 54                                            str  16, 65
  5762.             sciinfo  15, 55, 56, 58,                                            substr  16, 65
  5763.                 61, 62, 63, 67, 68
  5764.             scikadd  16, 56, 57
  5765.             scikcur  16, 58
  5766.             scikdel  16, 59
  5767.             scikfind  15, 58, 60, 67,
  5768.                 68
  5769.             scikfirst  15, 58, 62, 67,
  5770.                 68
  5771.             sciklast  15, 58, 63, 67,
  5772.                 68
  5773.  
  5774.  
  5775.  
  5776.  
  5777.                                         100