Im pretty new at programing and recently wrote a program to identify resistor colors.
I wrote, compiled, and ran the program using PellesC. I ran the program once and t wrked with no errors. When I tried to run it again and got
POLINK:fatal error: Access is denied ***error code: 1***.
Does anyone have advice on how to correct this and why it happened? Thanks
Fatal error code
Page 1 of 16 Replies - 4170 Views - Last Post: 06 July 2010 - 11:28 PM
Replies To: Fatal error code
#2
Re: Fatal error code
Posted 06 July 2010 - 09:27 PM
sawyer686, on 06 July 2010 - 10:24 PM, said:
how to correct this
Without seeing the code, it's hardly possible to guess how to correct what went wrong.
sawyer686, on 06 July 2010 - 10:24 PM, said:
why it happened?
Because it tried to read or write to a file or directory that it didn't have access to. This is the best guess I can come up with, without seeing the code.
#3
Re: Fatal error code
Posted 06 July 2010 - 09:33 PM
/*******************************************************************************
* Week 4 - Program to find color of resistor
*******************************************************************************/
#include <stdio.h>
void printColor(char digit);
int main(int argc, char *argv[])
{
char digit1;
char digit2;
char digit3;
int validinput = 0;
do {
printf("Enter 3 digits>");
scanf("%c%c%c", &digit1, &digit2, &digit3);
if ((digit1 >= 48 && digit1 <= 57) &&
(digit2 >= 48 && digit2 <= 57) &&
(digit3 >= 48 && digit3 <= 57)) {
validinput = 1;
}
}while (validinput == 0);
printf("Digit1 is: ");
printColor (digit1);
printf ("\n");
printf("Digit2 is: ");
printColor(digit2);
printf("\n");
printf("Digit3 is: ");
printColor(digit3);
printf("\n");
return 0;
}
void printColor(char digit) {
if (digit == '0')
printf("Black");
else if (digit == '1')
printf("Brown");
else if (digit == '2')
printf("Red");
else if (digit == '3')
printf("Orange");
else if (digit == '4')
printf("Yellow");
else if (digit == '5')
printf("Green");
else if (digit == '6')
printf("Blue");
else if (digit == '7')
printf("Violet");
else if (digit == '8')
printf("Gray");
else if (digit == '9')
printf("White");
else
printf("invalid");
return;
}
This post has been edited by no2pencil: 06 July 2010 - 09:33 PM
Reason for edit:: Added code tags
#4
Re: Fatal error code
Posted 06 July 2010 - 09:38 PM
Works fine for me...
Oh, are you maybe trying to compile your code while the exe is still running? Check to see if your code is still running, if you can't find it, try a reboot. I'll bet that's what has happened.
Quote
>$vi digit.c
>$make digit
cc digit.c -o digit
>$./digit
Enter 3 digits>123
Digit1 is: Brown
Digit2 is: Red
Digit3 is: Orange
>$make digit
cc digit.c -o digit
>$./digit
Enter 3 digits>123
Digit1 is: Brown
Digit2 is: Red
Digit3 is: Orange
Oh, are you maybe trying to compile your code while the exe is still running? Check to see if your code is still running, if you can't find it, try a reboot. I'll bet that's what has happened.
#5
Re: Fatal error code
Posted 06 July 2010 - 09:44 PM
no2pencil, on 06 July 2010 - 08:38 PM, said:
Works fine for me...
Oh, are you maybe trying to compile your code while the exe is still running? Check to see if your code is still running, if you can't find it, try a reboot. I'll bet that's what has happened.
Quote
>$vi digit.c
>$make digit
cc digit.c -o digit
>$./digit
Enter 3 digits>123
Digit1 is: Brown
Digit2 is: Red
Digit3 is: Orange
>$make digit
cc digit.c -o digit
>$./digit
Enter 3 digits>123
Digit1 is: Brown
Digit2 is: Red
Digit3 is: Orange
Oh, are you maybe trying to compile your code while the exe is still running? Check to see if your code is still running, if you can't find it, try a reboot. I'll bet that's what has happened.
Im going to reboot now and see if that works. Thankyou
#6
Re: Fatal error code
Posted 06 July 2010 - 10:17 PM
> I ran the program once and t wrked with no errors. When I tried to run it again and got
> POLINK:fatal error: Access is denied ***error code: 1***.
Are you sure the first instance has truly ended?
Are you still debugging? or has the debugger just detached from the exe?
Because the problem is the linker is not able to write to the exe, and the usual reason for this is that it is still running.
If it happens again, check with task manager to see if it's still running.
> POLINK:fatal error: Access is denied ***error code: 1***.
Are you sure the first instance has truly ended?
Are you still debugging? or has the debugger just detached from the exe?
Because the problem is the linker is not able to write to the exe, and the usual reason for this is that it is still running.
If it happens again, check with task manager to see if it's still running.
#7 Guest_c.user*
Re: Fatal error code
Posted 06 July 2010 - 11:28 PM
digit1 >= 48 && digit1 <= 57
try
try
#include <ctype.h>
...
if (isdigit(digit1) && isdigit(digit2) && isdigit(digit3))
...
Page 1 of 1

New Topic/Question
Reply



MultiQuote



|