I am trying to read in a text file, that contains multiple strings per record. Two of those strings have embedded blanks. I am trying to read in the string with fgets, and then split the strings out to separate char strings.
I have succeeded in doing so with the following code, however, the field "desc" is coming up blanks. Not sure why .... any ideas?

Here is the code:

/* Create a file */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
/* Function Prototypes */
void SplitRecord(char, int, int);

/* Declaratives */
const int field_lengths[] = {10, 52, 21, 20, 22, 6, 3, 11, 11, 27, 2, 8};
const int num_fields = 12;
const int rec_length = 193;
char inbuf[194]; /* record_length + 1 */
char outbuf[205]; /* rec_length + (num_fields -1) + 1 */

char *curr_in;

const char drive1[1];
const char input_file_name[12];
char in_filename[12];

const char drive2[1];
const char output_file_name[12];
char out_filename[12];

const char in_datetime[12];

const char file_chars[] = ":\\";


char desc[52];
char price[21];
char date[20];
char quantity[6];
char num1[11];
char num2[11];
char name[27];
char total[8];

int i;
int x;
int field;


main()
{
FILE *inPtr;
FILE *outPtr;

printf("\nPlease enter the drive being used for input (e.g. a) and press enter.\n");
gets(drive1);
printf("\nPlease enter the name of the input file (e.g. input.dat) and press enter.\n");
gets(in_file_name);
printf("\n**************************************** ****************************************\n");

strcpy(in_filename, drive1);
strcat(in_filename, file_chars);
strcat(in_filename, input_file_name);

printf("\nPlease enter the drive being used for output (e.g. a) and press enter.\n");
gets(drive2);
printf("\nPlease enter the name of the output file (e.g. output.dat) and press enter.\n");
gets(output_file_name);

printf("\n**************************************** ****************************************\n");
printf("\nPlease enter date and time for processing (e.g. CCYYMMDDHHMM) and press enter.\n");
gets(in_datetime);

printf("\n**************************************** ****************************************\n");
printf("\nThank you .... The program is creating your file .... Please wait.\n");
printf("\n**************************************** ****************************************\n");

strcpy(out_filename, drive2);
strcat(out_filename, file_chars);
strcat(out_filename, output_file_name);


/* Open File, check for NULL */
if((inPtr = fopen(in_filename, "r")) == NULL)
printf("Input file could not be opened\n");

else
{
if((outPtr = fopen(out_filename, "w")) == NULL)
printf("Output file could not be opened\n");
else
{
/* Initialize segments constants, separators and carriage */

/* Loop Through Records */
while (!feof(inPtr))
{
fgets(inbuf, (rec_length + 1), inPtr);
printf("%s%d\n", "Strlen(inbuf): ", strlen(inbuf));
if (strlen(inbuf) == rec_length)
{
for (field = 0, curr_in = inbuf; field < num_fields; curr_in += field_lengths[field], field++)
{
switch (field)
{
case 0: for (x=0; x < field_lengths[0]; x++);

case 1: for (x=0; x < field_lengths[1]; x++);
{ desc[x] = curr_in[x];
}
case 2: for (x=0; x < field_lengths[2]; x++)
{ price[x] = curr_in[x];
}
case 3: for (x=0; x < field_lengths[3]; x++)
{ date[x] = curr_in[x];
}
case 4: for (x=0; x < field_lengths[4]; x++);
case 5: for (x=0; x < field_lengths[5]; x++)
{ quantity[x] = curr_in[x];
}
case 6: for (x=0; x < field_lengths[6]; x++);

case 7: for (x=0; x < field_lengths[7]; x++)
{ num1[x] = curr_in[x];
}
case 8: for (x=0; x < field_lengths[8]; x++)
{ num2[x] = curr_in[x];
}
case 9: for (x=0; x < field_lengths[9]; x++)
{ name[x] = curr_in[x];
}
case 10: for (x=0; x < field_lengths[10]; x++);

case 11: for (x=0; x < field_lengths[11]; x++)
{ total[x] = curr_in[x];
}
}
}
printf("%s%s\n", "Desc: ", desc);
printf("%s%s\n", "Price: ", price);
printf("%s%s\n", "Date: ", date);
printf("%s%s\n", "Quantity: ", quantity);
printf("%s%s\n", "Num1: ", num1);
printf("%s%s\n", "Num2: ", num2);
printf("%s%s\n", "Name: ", name);
printf("%s%s\n", "Price: ", total);
}
}
fclose (inPtr);
fclose (outPtr);
}
}
return 0;
}