Thread: Help
View Single Post
  #2 (permalink)  
Old July 26th, 2003, 04:15 AM
Ankur_Verma Ankur_Verma is offline
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: