How would I go about adding a string array to another string array? I am scanning a file that takes each word and puts it in to a string array wbuf[]. Then I am sending wbuf[] to a function that checks if there is enough room in the lbuf[62] array. If there is enough room it copies wbuf[] into lbuf[62]. I can get it to copy one word into lbuf[62], but I can get it to continue to add the next words without running in to errors. Should i use sscanf(wbuf "%s", lbuf)? Sorry I am relatively new to programming. Thanks in advance.

Code:

// Tanner Brandt
// 002617908


#include <stdio.h>
#include <string.h>
#define MAX_LINE_LEN 62




int output (char wbuf[]);
int space_check(int line_len);
int get_text(void);


int lbuf_len = 0;


    FILE *gettyText;
    FILE *csis2;


int main(void){


    fopen_s(&gettyText, "getty.txt", "r");
    fopen_s(&csis2, "csis2.txt", "w");


    get_text();
    
    getchar();
    return 0;
}


int get_text(void)
{
    int n = 0;
    
    char wbuf[10];
    
    while (!feof(gettyText))
    {
        fscanf(gettyText, "%s", wbuf);
        output(wbuf, n);
            printf("test");
            n++;
    }
    return 0;


}


int output(char wbuf[], int n)
{
    extern int lbuf_len;
    int wordLength;
    char lbuf[62];
    
    wordLength = strlen(wbuf); // determines the size of the word    
    lbuf_len += wordLength; 



    if(space_check(lbuf_len) > wordLength - 1){
        printf("%s", wbuf);
                sscanf(wbuf, "%s", lbuf[n]); // This is my problem
        strcat(wbuf, lbuf);              // This area is the problem
        n++;
        puts(lbuf);
        //printf("%s", lbuf[n]);    // This is where I get the error
            }


    if (space_check(lbuf_len) < wordLength -1){
        lbuf_len = 0;
        printf("Cleared space_remaining");
        getchar();
            }


    return 0;


}
    
int space_check(int lbuf_len){


    int space_remaining;


    space_remaining = MAX_LINE_LEN - lbuf_len;


    printf("%d", space_remaining);
    getchar();


    return space_remaining;
}