Atom is detecting false errors

I’ve used Code:blocks before, I’m new to this environment. I wrote a code (C programming) and atom is detecting issues and when I compiled the same code in an online compiler, it turned out to be fine.
Note: 1. I’ve added atom in environmental variables(in both user and system path)
2. Other codes(C programs) runs fine.

My code:

#include <stdio.h>
int main()
{
char ch=‘W’;
if (ch >=‘a’ && ch <=‘z’) {
printf("%c is lower case\n", ch);
}
if (ch >=‘A’ && ch <=‘Z’) {
printf("%c is Upper case\n", ch);
}
return 0;
}

command promt output:

‘C:\Users\SH21~1\AppData\Local\Temp\Upper-Lower’ is not recognized as an internal or external command,
operable program or batch file

There are a few things that you need to understand first. Atom isn’t detecting anything here. Atom can’t detect errors in code because it has no awareness of what code languages are beyond the ability to highlight them. In order to run code in Atom, you have to have a package installed. The package you have installed is sending a bad command string to your operating system, which we can tell because Windows is giving you the generic error that happens any time you try to run a program that doesn’t exist. Your file is probably in a folder that starts with Upper-Lower and then has a space after it, and since the package is not handling the string correctly (by wrapping it in quotes before shipping it off to the shell), Windows thinks that you want to run a program called C:\Users\SH21~1\AppData\Local\Temp\Upper-Lower. You should try removing all spaces from the file path, or moving the file to a different location.

Theorising … it could be that this string is somehow being treated incorrectly as an arithmetic operation … to test this theory change Upper-Lower to UpperLower (dropping the minus sign) and see if other errors popup.

That’s not what the error says, though. That error is very specific about what’s going on and is spawned by the cmd shell that Windows uses when you try to call a program that doesn’t exist in the PATH or the current folder. Say the folder is called “Upper-Lower Comparison”. All text-based shells that I know of separate their arguments with spaces, so the space after “Lower” indicates the start of the next part of the command string. The shell therefore looks for a program called Upper-Lower in the Temp/ folder, which it isn’t able to find because such a program doesn’t exist.

1 Like

It worked bro
Thanks for the assistance

No problem. :slight_smile: