Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 136,412 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 2,448 people online right now. Registration is fast and FREE... Join Now!




error handling

 
Reply to this topicStart new topic

error handling, not giving output

avinandanaot
15 Oct, 2008 - 06:54 AM
Post #1

New D.I.C Head
*

Joined: 14 Oct, 2008
Posts: 13


My Contributions
CODE
#include<stdio.h>
#include<conio.h>
main()
{
char *filename;
FILE *fp1,*fp2;
int i,number;
fp1=fopen("TEST","w");
for(i=10;i<=100;i+=10)
putw(i,fp1);
fclose(fp1);
printf("\n Input filename\n");
open_file:
scanf("%s",filename);
if((fp2=fopen(filename,"r"))==NULL)
{
printf("\n Cannot open the file\n.");
printf("\n Type filename again\n\n");
goto open_file;
}
else
for(i=1;i<=20;i++)
{
number=getw(fp2);
if(feof(fp2))
{
printf("\n Ran out of memory\n");
break;
}
else
printf("%d\n",number);
}
fclose(fp2);
}


Mod edit - Please code.gif
~BetaWar
User is offlineProfile CardPM
+Quote Post

BetaWar
RE: Error Handling
15 Oct, 2008 - 06:57 AM
Post #2

#include <soul.h>
Group Icon

Joined: 7 Sep, 2006
Posts: 2,022



Thanked: 81 times
Dream Kudos: 1175
My Contributions
What errors are popping up that you are trying to handle? What is the problem?

We need to know some more information before we will be able to help you.
User is offlineProfile CardPM
+Quote Post

avinandanaot
RE: Error Handling
15 Oct, 2008 - 07:09 AM
Post #3

New D.I.C Head
*

Joined: 14 Oct, 2008
Posts: 13


My Contributions
please tell me how to paste codes
I am new to this site
User is offlineProfile CardPM
+Quote Post

BetaWar
RE: Error Handling
15 Oct, 2008 - 07:14 AM
Post #4

#include <soul.h>
Group Icon

Joined: 7 Sep, 2006
Posts: 2,022



Thanked: 81 times
Dream Kudos: 1175
My Contributions
You put your code on the page like so:
code.gif
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/2/08 12:33PM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month