"bena" <[EMAIL PROTECTED]> wrote:
>
> EVERY TIME I RUN THIS PROGRAMME THE COMPILER SHUTDOWN

I have no idea why the compiler would shut down, but there are lots
of things wrong with your code.

> TELL ME PLZ WHY
> I REALLY WANT TO KNOW

Of course you do, that's why your posting to the group. SHOUTING at
us, or otherwise stressing your dilema tends to have the opposite
effect as far as getting responses though.

[Try walking into a doctor's surgery and insisting the doctor see you
about your mysterious ache in an unspecified area _ahead_ of the
other dozen strangers in the waiting room, and see what the response
is!]

As far as help goes, there plenty of things you can do to help
yourself, _before_ you rush off to post your code to a group for
assistance.

The most obvious is to reduce your code the smallest snippet which
exhibits the problem! Had you _tried_ this, I dare say you would have
found your problem in a few minutes.

Your real problem is that you NEVER check error codes, particularly
those from fopen(). Since your code doesn't care whether fopen fails
or not, your code merily goes on it's way trying to destroy the
system, it ultimately succeeds, hence you get crashes.

> #include<stdio.h>
>
> int main()
> {
>
>  FILE *il,*cur,*next,*per;
>  float a[100][50],b[102][102],e[100][50],r[101][51],temp[100][50];

That's a lot of automatic memory. Making it static would avoid stack
overflow on many machines.

>  char name[2];

You're tring to store strings like "31.txt" in an array that will
only hole 1 character plus the null byte. You have self-inflicted
buffer overflow problems.

>  int i,j,k,m,s,counter,w,q;

What are all these for?

Why is the whole of your code inside main()?

<snip>
>  for (i=1;i<=31;i++)            //create 32 file
>  {
>       sprintf(name,"%d.txt",i);
>       il =fopen(name,"w+");
>
>       for(i=0;i<5151;i++)

You're using i for both the inner and outer loop counters! What do
you think will happen?

>                         fprintf(il,"70 ");

Why are you printing a 15000+ character single line to a text file?

Since you failed to terminate the line with a newline, you have no
guarantee that anything will be written to file anyway.

Note also that you never close the file, so it's highly likely that
your subsequent attempts to open them for reading will fail.

>  }

In short, you seem too impetuous in your coding. It's clear you
haven't really sat down to design your code. You have reeped what you
have sewn. There's a lesson in this for you, over and above the
technical difficulties with your code. I suggest you learn from it. ;)

--
Peter





To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>.


Yahoo! Groups Sponsor

Get unlimited calls to

U.S./Canada

Web Bug from http://view.atdmt.com/VON/view/yhxxxvon01900091von/direct/01/&time=1099960504430292
Web Bug from http://us.adserver.yahoo.com/l?M=281955.5530326.6602771.3001176/D=groups/S=:HM/A=2343726/rand=965183546


Yahoo! Groups Links

Reply via email to