How can I reject an alphanumeric command-line argument (i.e. ./main 20x), but not a solely numeric one (i.e. ./main 20)? (in C)

I have figured out how to reject a purely alphabetical argument. I cannot figure out how to reject an alphanumeric user input while passing numeric inputs. Here is my relevant code: #include <cs50.h> #include <stdio.h> #include <string.h> #include <ctype.h> int main(int argc, string argv[]) { if (argc != 2 || isalpha(*argv[1])) { printf(“Usage: ./caesar key\n”);…

Details

How to find the current project’s directory from within a Rmd file?

I run MyReport.rmd file from Rstudio and do: # set working path to this file’s path if (rstudioapi::isAvailable()) { currentPath <- rstudioapi::getActiveDocumentContext()$path } else { currentPath <- ??? } setwd(dirname(currentPath)) print(getwd()) The rstudioapi::isAvailable() evaluates to false in my Rmd file for some reason. However, doing that in a .r file it works fine.

Details