Character permutations - Revisited
A few notes:


You aren't declaring alphabet in a very readable and maintainable form.  Here's how I would do it:

static const char alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";


As you can see, I also made this variable static and const.  static renders variable local to the file, and const makes it so that we can't screw with the array somewhere along the line (and also makes things a tidbit faster).  This leads me to my next point...

Also, you don't have to specify the number of elements in the array when you declare it like this, since the compiler can determine that itself (because it is constant).
fp and len are global variables when they shouldn't be.  Arguably alphabet shouldn't be one either, but I think it is find as long as you have the static in front of it.  Anyways, they should be declared as local variables and then passed to the functions that need them.
I'm not sure your algorithm is the most optimal.  I used a method known as "backtracking" myself, which seems to be the most efficient that I could find in practice.
fprintf() isn't going to be as efficient compared to fwrite().  I would consider rewriting your code if you still want to generate a permutation table.




Time test (without compiler optimizations)

mycode.c:

#include &lt;stdio.h&gt;
#include &lt;string.h&gt;
#include &lt;stdlib.h&gt;

static const char alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
static const int alphabetSize = sizeof(alphabet) - 1;

static void bruteImpl(char* str, size_t index, size_t maxDepth)
{
    for (size_t i = 0; i &lt; alphabetSize; ++i)
    {
        str[index] = alphabet[i];

        if (index == maxDepth - 1); //printf("%s\n", str);
        else bruteImpl(str, index + 1, maxDepth);
    }
}

void bruteSequential(size_t maxLen)
{
    char* buf = calloc(maxLen + 1, sizeof(char));

    for (size_t len = 1; len &lt;= maxLen; ++len)
    {
        bruteImpl(buf, 0, len);
    }

    free(buf);
}

int main(void)
{
    bruteSequential(5);
}





$ gcc opCode.c # I took out your fprintf call so that it wouldn't be a factor
$ time ./a.out 

real  0m0.170s
user  0m0.139s
sys   0m0.009s

$ gcc mycode.c
$ time ./a.out

real  0m0.043s
user  0m0.039s
sys   0m0.002s