title: UBUNTU on VMWARE Segmentation fault (core dumped)
body: <p>sorry if my english is horrible: I'm realy stresed :(
  I'm using Ubuntu 11.04 that work as virtual machine. Using VMWARE as virtual machine operating system is windows 7.
  I'm trying to write a program on linux with C language: that using shared memory. when I try to compile there are no errors but when I execute it I see an error like this:
      Segmentation fault (core dumped)
  I'm not sure but as far as I learned VMWARE is causing this :S
  here are the codes:</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;sys/wait.h&gt;    //Process wait
  #include &lt;fcntl.h&gt;  //File
  //#include &lt;cstdlib&gt;
  //#include&lt;fstream.h&gt;
  
  int main(){
  
    printf("\n Here we go...!");
    int *Numbers;
    Numbers=(int*)getmem(327); // shared memory
  
    int i,ProcID;
    ProcID=fork(); //depart processor
  
    if(ProcID==0){          // child processor
      for(i=0;i&lt;50;i++){
        Numbers[i]=random()%50;   
      }
    }else if(ProcID&lt;0){
      printf("\n Hmm... There is an error!");
    }
  
    int Waiting;
    wait(&amp;Waiting);   
  
    if(ProcID&gt;0){          // parent processor
  
      int fileeven,fileodd;
      fileeven=open("EK_even.txt",O_RDWR|O_CREAT,0600);
      fileodd=open("EK_odd.txt",O_RDWR|O_CREAT,0600);
  
      for(i=0;i&lt;50;i++){
        if(Numbers[i]%2==0){
      write(fileeven,&amp;Numbers[i],sizeof(Numbers[i]));
        }else{
      write(fileodd,&amp;Numbers[i],sizeof(Numbers[i]));
        }
      }
  
      close(fileeven);
      close(fileodd);
  
    }else if(ProcID&lt;0){
      printf("\n Hmm... There is an error!");
    }
    return 1;
  }
  </code></pre>
  
  <p>I'm using this to compile on terminal:gcc -o ./RUN ./EK.c -shared
                  to Run               :./RUN
                  as  result           :Segmentation fault (core dumped)</p>
  
  <p>Thanks for your time and reponds I'm realy in need...</p>