'How to move characters in a string over 'X' amount of times from command line argument in C?

#include <stdio.h>

int main(int argc, char **argv[]){
int i = 0;
char ch[100];

FILE fp*;

fp = fopen(argv[1], "w");
char str[1000];


if(argc > 4){
    printf("Invalid number of arguments, must be exactly 4");//necessary error message.
    return 1;
}

if(argv[1] == NULL){
    printf("Could not open file %s", argv[1]);//necessary error message
    return 1;
}

if(strcmp(argv[2], "encode") == 0)){
    while(*(*(argv + 3) + i)){//points to first character in the fourth parameter
        ch = (*(*(argv + 3) + i));//assigns ch with first character
        if(ch = 'L'){
            fscanf(argv[1], "%s", str);
                                       //not sure how to shift the characters over each time

        }

    }

}
else{
    printf("Invalid option, must be 'encode' or 'decode'");
    return 1;

}

if(strcmp(argv[2], "decode") == 0)){

}
else{
    printf("Invalid option, must be 'encode or 'decode'");
    return 1;

} 








return 0;
}

The program is supposed to be an encorder/decorder of an input file of string. One of the features is to move the characters within a string from a file over "X" number of times as input by the user in the command line. The command line takes four arguments. The first is the execution of the file, second is the file name, third is the encode or decode option, and the fourth specifies how the file will be encoded/decoded. For example, if the user inputs "encode" followed by "L6" into the command line, the program will recognize "L" to shift each character to the left 6 times. Much of the code will be the same for the decode feature. I have only chosen to work on the encode option first. How can I shift these characters over with input from the command line? Also, I am not able to use

conio.h

so any features from this library will not work.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source