Can't Read Dbase data file from C program [HELP] 
Author Message
 Can't Read Dbase data file from C program [HELP]

Quote:

>Hi All
>    I need to write a C program to access (read) Dbase data file. Can any
>one show me a sourse code please.

  FILE *fp;

  /* It is important to open binary data files in binary mode */

  fp = fopen("foo.dbf", "rb");

  /* The rest is between you and the dBase file format. I will not
     admit knowing something about such stuff if challenged, but I
     will still give you the hint that there is more than one dBase
     file format */

Quote:
>    And how can I print out data to printer by program control ?

  with fprintf(), using the approriate stream for your system.

I usually use

  FILE *prn = popen("/usr/lib/lp/postscript/postprint -n 2 -|lp -T postscript");

to open that stream, but your mileage may vary. Therefore, it is a good
idea to ask system specific questions in system specific newsgroups.
Being new to C, you need not know that "printing" is a system specific
issue in C. Being new to usenet, you should ar least know that reading
the FAQ for a newsgoup is required _before_ posting to that group. In
the FAQ for comp.lang.c you find:

        Under Unix, either use popen() (see question 19.30) to write to
        the lp or lpr program, or perhaps open a special file like
        /dev/lp.  Under MS-DOS, write to the (nonstandard) predefined
        stdio stream stdprn, or open the special files PRN or LPT1.

hidden under the question "How can I direct output to the printer?".
The only problem left to match this topic with your question is to
find out what "redirect" means.

Kurt

--
| Kurt Watzka                             Phone : +49-89-2180-6254



Thu, 03 Jun 1999 03:00:00 GMT  
 Can't Read Dbase data file from C program [HELP]

Hi All

        I need to write a C program to access (read) Dbase data file. Can any
one show me a sourse code please.
        And how can I print out data to printer by program control ?

Thank's

--
Leo TANG :)



Fri, 04 Jun 1999 03:00:00 GMT  
 Can't Read Dbase data file from C program [HELP]

Quote:

>         I need to write a C program to access (read) Dbase data file. Can any
> one show me a sourse code please.

FAQ:    Where do I find a description of
        dBASE / Xbase / dbf / ndx file format ?

Try
        http://www.geocities.com/SiliconValley/Pines/2563/xbase.htm
or
        http://www.wotsit.demon.co.uk/formats/dbf/xbasefmt.txt

From there you'll find links to C source etc.

Regards

Erik Bachmann

Home:   http://www.geocities.com/SiliconValley/Pines/2563



Fri, 04 Jun 1999 03:00:00 GMT  
 Can't Read Dbase data file from C program [HELP]

:       I need to write a C program to access (read) Dbase data file. Can any
: one show me a sourse code please.
:       And how can I print out data to printer by program control ?
:
You may want to take a look at the following web site as they
may have information about the dBase file format.

   Wotsit's Format  http://www.wotsit.demon.co.uk
   The programmer's File Format collection at Wotsit's Format.

Also the I think the Borland Database Engine SDK supports the dBase
file format.


Author of: Hardware Digital Logic Analyers for Windows
           Zeus for Windows, Win32 (Brief, WordStar, Emacs) Text Editor
"The C/C++, Java, Pacal, Cobol, fortran programmers text editor"
Home Page: http://ourworld.compuserve.com/homepages/jussi/



Fri, 04 Jun 1999 03:00:00 GMT  
 Can't Read Dbase data file from C program [HELP]

Quote:

>Hi All
>    I need to write a C program to access (read) Dbase data file. Can any
>one show me a sourse code please.
>    And how can I print out data to printer by program control ?

ok, this may seem superflous, but:

a>get a program that redirects printer output a file
b>write a Dbase program that prints your database
c>write a C program with trees that inputs the printed file

this is 1 longway to do it, if dBase doesn't support direct calls,
which I believe it does. the other way would be to get a database
library, or connect to the Visual Basic professional edition 3 DLL,
but that's a whole new set of worms.

of course, the next step will be to convert the Dbase prg files
which mean you're going to have to look for a file converter or
just write one. of course if the prg file is small enough, you could
just translate it.

the internet is big, and i wouldn't be suprised if by looking at
standard sites, like oak.oakland.edu or yahoo if it had both the file
converter and program converter.



Sun, 06 Jun 1999 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. program can't read its own data files

2. Newbie: separate big .cs file into small .cs files

3. How to assimilate a dbase file using file opens() and reads()

4. Help with compiling a "canned" program

5. reading data file from C program

6. reading fortran data file from C program

7. Reading and writing dbase files in C

8. how to read dBase (dbf) files

9. Reading dBase formatted database files from C

10. How do I read dbase file in c

11. How Can we update dBase file by Microsoft.Data.Odbc in C#

12. Can't retrieve cookies in .cs file, but works in aspx page

 

 
Powered by phpBB® Forum Software