Permission denied? chapter 2 exercise 5 from book of Francis Glassborrow

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Paola81
    New Member
    • Oct 2012
    • 2

    #1

    Permission denied? chapter 2 exercise 5 from book of Francis Glassborrow

    I'm trying to learn C++ with the book of Francis Glassborrow".

    I'm trying to solve the exercise 5 of the chapter 2.

    I have the same error if I use the solution proposed by Francis then mine.

    Here is the code proposed by Francis:
    Code:
    #include "playpen.h"
    #include <iostream>
    
    using namespace fgw;
    using namespace std;
    
    int main()
    {
    	playpen papier;
    	papier.taille(32);
    	
    	for (int i(0); i!=16; ++i)
    	{
    		for (int j(0);j!=16; ++j)
    		{
    			papier.tracer (i-8,j-8,(i*16+j));
    			papier.afficher();
    		}
    	}
    	
    	cout << "Appuyer sur ENTER pour sortir du programme";
    	cin.get();
    }
    This program must display the 256 colours.

    When I execute the program. there is an error :
    "cannot open output file C:\ tutorial\Chapte r 2\ex5.exe: Permission denied.

    I don't understand why it doesn't work!

    Somebody can help me?

    Paola
    Last edited by Frinavale; Oct 25 '12, 01:59 PM. Reason: Added code tags and fixed grammar & spelling.
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    I suspect that you have been debugging this code several times. This time the ex5.exe needs to be overwritten with the new build but you still have it open from a previous attempt. The write cannot occur with the file open.

    Comment

    • Paola81
      New Member
      • Oct 2012
      • 2

      #3
      You're right.
      The program is running correctly now.
      Thank you very much for your help.

      Kind Regards

      Paola

      Comment

      Working...