Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old July 23rd, 2003, 11:51 AM
Registered User
 
Join Date: Jul 2003
Location: kampala, , Uganda.
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, 05:15 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
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:
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off



All times are GMT -4. The time now is 01:24 PM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.