Thread: connecting database to the interface

  1. #1
    Unregistered
    Guest

    Question help with binary files

    hell all,

    i have been searching for info on binary files but have not been able to find enough info to help me out with my project. could you please let me know of any good internet sources out there?

    tnx

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    What do you need to do with them?

    -Prelude
    My best code is written with the delete key.

  3. #3
    Unregistered
    Guest

    Question connecting database to the interface

    hello ppl,
    how do i connect database to the interface? is there a specific way of getting the two mixed up. ( i mean, when i receive input on the screen how do i save them into my binary files and the database)

    (the interface is built by curses and ncurses and the software is for adding clients and getting there info).

    I know this question might not make sense but i appreciate it if you could give me anytype of info(or maybe internet sources that i could refer to )

    thanks,

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Next time, reply to a thread, don't start a new one

    From say
    Code:
    struct {
       char name[10];
       int age;
    } mydb[200];
    Which is an array of 200 elements, containing names and ages

    To write to a file, do this
    Code:
    FILE *fp = fopen("file.db","wb");
    fwrite( mydb, sizeof(mydb[0]), 200, fp );
    fclose( fp );
    Reading is the reverse
    Code:
    FILE *fp = fopen("file.db","rb");
    fread( mydb, sizeof(mydb[0]), 200, fp );
    fclose( fp );

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Error connecting from Dev C++ to MS Access Database
    By Sridar in forum C++ Programming
    Replies: 0
    Last Post: 04-15-2006, 06:09 PM
  2. Connecting to sql database on server
    By jverkoey in forum Windows Programming
    Replies: 1
    Last Post: 05-01-2004, 06:56 PM
  3. connecting to ms access database
    By fkheng in forum Windows Programming
    Replies: 12
    Last Post: 07-06-2003, 07:49 PM
  4. connecting to an MS Access database
    By Dimeslime in forum Windows Programming
    Replies: 0
    Last Post: 02-09-2002, 03:11 PM
  5. Replies: 1
    Last Post: 10-09-2001, 10:20 PM