Wrox Programmer Forums
|
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 23rd, 2003, 10:51 AM
Registered User
 
Join Date: Jul 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help


Hi everyone at WROX,

This Anton writing once again seeking online help on this site.
I precedently wrote in quest for help on how appropriately i can write to the disk file using C++/C file input and output, but in vane.

I please writ back to persist so that you experienced programmers can help me.
I sent you my actual code i use but i'm afraid i aint got a reply as yet.

 I'll be so grateful if i atleast receive some advice or hints about overcoming my task.

                                          Thanks and Bye for now,
                                                  Anthony.


Reply With Quote
  #2 (permalink)  
Old July 26th, 2003, 04:15 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 453
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Ankur_Verma Send a message via MSN to Ankur_Verma
Default

Hi Anthony

I have gone through your code and it seems that I have
found out why nobody ever replied to your query.

Friend your code has a very basic flaw
just have a look at the condition at which you are
allowing your code to write the data in the file.
it is

if((fp=fopen("temp.txt","wt+"))==0)

as soon as
fopen("temp.txt","wt+") gets executed
the file gets created and fp gets some value
assiged to it which means it is no longer zero.

but for your file writing code to be
reached the condition
..==0) has to be true which will never be
the case 'cause as I said fp in not null anymore.

change the condition to

if((fp=fopen("temp.txt","wt+"))!=0)

notice !=0

and your code should work fine.

Ankur Verma
.Net and C++ Specialist
Wiley Tech Support
Reply With Quote
The Following User Says Thank You to Ankur_Verma For This Useful Post:









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