connecting database to the interface

This is a discussion on connecting database to the interface within the C Programming forums, part of the General Programming Boards category; hell all, i have been searching for info on binary files but have not been able to find enough info ...

  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,796
    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 wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,452
    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, 02:11 PM
  5. Replies: 1
    Last Post: 10-09-2001, 10:20 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21