"Permission Denied" v. Noob Question

Discussion in 'OT Technology' started by n9e9o9, Feb 12, 2008.

  1. n9e9o9

    n9e9o9 lol OT Supporter

    Joined:
    Aug 26, 2003
    Messages:
    5,083
    Likes Received:
    0
    Location:
    ATX
    I'm using Dev-C++ as a compiler. This random number generator program was running fine, then all of a sudden I keep getting an error:

    "Permission Denied" in line 38

    I think its trying to write to some read-only file, but not sure. The programs runs, regardless of recompiling it. What's going on? :wtc:

    Code:
    #include <fstream>
    #include <conio.h>
    
    using namespace std;
    
    double randu(int iseed1);
    double ans[1000];
    
    int main(){
    int i;
        double iseed;
        int rnd=0;
    for (i=1; i<1000; i++){
        ans[i] = randu(i+1);
        printf("%d \n", ans[i]);
    }
    
    //scanf("%d", &i);
    
    getch();
    
    }
    
    double randu(int iseed1)
    {
    double IMAX = 2147483647;
    double XMAX_INV = 1.0/IMAX;
    double rand;
    
         iseed1 = iseed1 * 65539;
         rand=0;
         if(iseed1 < 0){
            iseed1 += IMAX + 1;
         }
         rand = iseed1 * XMAX_INV;
         return rand;     
              
    }
    
     
  2. n9e9o9

    n9e9o9 lol OT Supporter

    Joined:
    Aug 26, 2003
    Messages:
    5,083
    Likes Received:
    0
    Location:
    ATX
    nvm figured it,

    i mislabeled the array ans[1000] for only 1000 values... my for loop was exceeding the amount of buffer space for memory that it started to reach "read-only" files, i was trying to change the loop to do 30000 values, for example

    :hs:
     

Share This Page