Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > C++ Programming
|
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old July 18th, 2003, 06:39 AM
Registered User
 
Join Date: Jul 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default writing to the disk file incase of database devt.

 My name is Antonio from Kampala, a Computer Science student at Kyambogo University. I'm so happy about this opportunity to the get on to first this online discussion/help by WROX.
  I'm trying to design a database in C++/C using Classes and Objects,i'm using the book Beginning C++ by IVOR HORTON.
I kindly beg to find out why when i enter the data in my output, in textmode, the file is created,but when i go to view the data, the file is empty?
  Please have a look at the code i use to write below;
      if((fp=fopen("temp.txt","wt+"))==NULL)
       { fprintf("\n Unable to open file for input");
          fclose(fp);
        }
      if((fp=fopen("temp.txt","wt+")==0)
         { for(int i=0;i<entries;i++)
             {
              fwrite((char*)&entries[i],sizeof(Employee));
             }
            fclose(fp);
          }
 where *fp is the FILE STRUCTURE,Employee is the object,entries are the number of entries made.
    Secondly, why is it C++ doesn't capture color using 'cout', i've to use cprintf instead?
  Please help me!!







Similar Threads
Thread Thread Starter Forum Replies Last Post
writing into a file in linux file system anboss XSLT 6 June 19th, 2008 01:56 PM
Writing back to the Database angieb1008 VB Databases Basics 0 January 4th, 2007 06:00 PM
Writing to Database Scripts82 ASP.NET 1.0 and 1.1 Professional 8 September 15th, 2006 07:47 AM
Writing to Database - Please Help Dwizz VB.NET 2002/2003 Basics 12 May 11th, 2005 08:37 AM
writing to a database charliejamesuk MySQL 1 March 25th, 2004 11:10 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.