campo-sirio/cb5/datainfo.c
alex a0f5e0898b This commit was generated by cvs2svn to compensate for changes in r975,
which included commits to RCS files with non-trunk default branches.

git-svn-id: svn://10.65.10.50/trunk@976 c028cbd2-c16b-5b4b-a496-9718f37d4682
1995-02-06 15:33:45 +00:00

80 lines
2.0 KiB
C
Executable File

/***********************************************************************\
* *
* DATAINFO.C Copyright (C) 1993 Sequiter Software Inc. *
* *
\***********************************************************************/
/* See User's Manual, page 63 */
#include "d4all.h"
#ifdef __TURBOC__
extern unsigned _stklen = 10000;
#endif
int main(int argc,char *argv[])
{
CODE4 code_base;
DATA4 *data_file;
FIELD4 *field_ref;
int j,num_fields;
int len,dec;
int rec_width;
char *name;
char type;
char *alias;
long rec_count;
if(argc != 2)
{
printf(" USAGE: FLDINFO <FILENAME.DBF> \n");
exit(0);
}
d4init(&code_base);
data_file = d4open(&code_base,argv[1]);
e4exit_test(&code_base);
rec_count = d4reccount(data_file);
num_fields = d4num_fields(data_file);
rec_width = d4record_width(data_file);
alias = d4alias(data_file);
printf("ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»\n");
printf("º Data File: %12s º\n",argv[1]);
printf("º Alias : %12s º\n",alias);
printf("º º\n");
printf("º Number of Records: %7ld º\n",rec_count);
printf("º Length of Record : %7d º\n",rec_width);
printf("º Number of Fields : %7d º\n",num_fields);
printf("º º\n");
printf("º Field Information : º\n");
printf("ÌÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍËÍÍÍÍÍÍËÍÍÍÍÍ͹\n");
printf("º Name º type º len º dec º\n");
printf("ÌÍÍÍÍÍÍÍÍÍÍÍÍÎÍÍÍÍÍÍÎÍÍÍÍÍÍÎÍÍÍÍÍ͹\n");
for(j = 1;j <= d4num_fields(data_file);j ++)
{
field_ref = d4field_j(data_file,j);
name = f4name(field_ref);
type = f4type(field_ref);
len = f4len(field_ref);
dec = f4decimals(field_ref);
printf("º %10s º %c º %4d º %4d º\n",name,type,len,dec);
}
printf("ÈÍÍÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÊÍÍÍÍÍÍÊÍÍÍÍÍͼ\n");
d4close(data_file);
return 0;
}