TIP: Click on subject to list as thread! ANSI
echo: clipper
to: JEAN MENTEN
from: FRANS VAN BOMMEL
date: 1997-11-12 20:17:00
subject: ..ch

 -=> Quoting Jean Menten to All <=-
 JM> Hallo ,
 JM> In the *.ch files you often find the next:
 JM> #DEFINE this            101
 JM> #DEFINE that            102
 JM> 1. what do those numbers mean ?
 JM> 2. can you incorporate these   in your programm, eg as a
 JM> variable ? 
Yes Jean! And it takes a lot less of your memory too!
Do the next: Use arrays with your variables instead of memvars. Define names
for every element in the array in your .ch refer to them in your code. The
advantage is that you can use this method to read, dit and save your data
in a very handsome way.
Look at this:
In your .ch file (your header file) you can define some manifest constants 
like
#define kNAAM		1
#define kADRES		2
#define kPOSTCODE	3
#define kPLAATS		4
#define kTELEFOON	5	
#define kUPDATED	6	// Updated
#define kRECORDNR	7	// Recordnr
#define kKARRAYLEN	7	// Length of the array 
Than on the first line in your .PRG:
#include [headerfile.ch]
FUNCTION something()
  LOCAL aKlant := ARRAY(kKARRAYLEN)	// Defines the right length of 7
  LOCAL cAlias := "klantem"
  LOCAL lRet   := .F.
  Open your database with customers
  aKlant[kNAAM]		:= (cAlias)->naam
  aKlant[kADRES]	:= (cAlias)->adres
  aKlant[kPOSTCODE]	:= (cAlias)->postcode
  aKlant[kPLAATS]	:= (cAlias)->plaats
  aKlant[kTELEFOON]	:= (cAlias)->tel
  If everything went ok...
     lRet := .T.
  ENDIF
RETURN(lRet)
Do with your data what you want to do and save your data in the opposite 
irec
tion.
  (cAlias)->naam	:= aKlant[kNAAM]
  etc.
As you can see, your array index numbers aKlant[1], aKlant[2] become more
meaningfull.
I hope his will make things easier. Also: buy the (Dutch) book of Ad van de
Lisdank about The Preprocessor!!!
Greetings,
Frans van Bommel
Diergaarde Blijdorp
... Documentation - The worst part of programming.
--- Blue Wave/DOS v2.30
---------------
* Origin: HEKOM Holland. Clipper and CDGN Headquarters. (2:2802/223)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.