Thank you for the comment about C boolean. I just swear I've used boolean in C before on my compiler (or was I just dreamming). Another strange problem is happening with my for loop interator 'i', and the int variable 'path_amount'...
#include <stdio.h>#include <stdlib.h>#include <string.h>int main(int argc, char *argv[], char *envp[]) { char **pCmdPath; char *pHomeDir, *pCurrentDir; char *result; result = getenv("HOMEPATH"); pHomeDir = (char *)malloc(strlen(result)); strcpy(pHomeDir, result); result = getenv("Path"); int path_amount = 1; for(int i = 0; i < strlen(result); i++) { if(result == ';') path_amount++; } // Free Memory free(result); free(pHomeDir); exit(0); // exit successful}
Errors:
1>.\main.c(16) : error C2143: syntax error : missing ';' before 'type'1>.\main.c(17) : error C2143: syntax error : missing ';' before 'type'1>.\main.c(17) : error C2143: syntax error : missing ';' before 'type'1>.\main.c(17) : error C2143: syntax error : missing ')' before 'type'1>.\main.c(17) : error C2143: syntax error : missing ';' before 'type'1>.\main.c(17) : error C2065: 'i' : undeclared identifier1>.\main.c(17) : warning C4552: '<' : operator has no effect; expected operator with side-effect1>.\main.c(17) : error C2059: syntax error : ')'1>.\main.c(17) : error C2143: syntax error : missing ';' before '{'1>.\main.c(19) : error C2065: 'path_amount' : undeclared identifier
Today is not a good day for I'm guess... (hahaha) = ]