Professional Documents
Culture Documents
h>
#include <string.h>
#include "student.c"
#pragma warning(disable: 4996)
if (argc > 0)
{
// Get name of file from command line argument
char inputFileName[124] = { 0 };
strcpy(inputFileName, (char*)argv - 1);
if (pstudent != NULL)
{
while (fgets(buffer, 400, pstudent))
{
if (strstr(buffer, ","))
{
strcpy(what[i].name, buffer);
printf("%s", what[i].name);
}
else if (strstr(buffer, "Assignment"))
{
strcpy(what[i].feedback, (char*)buffer);
printf("%s", what[i].feedback);
}
else if (strstr(buffer, "Comments"))
{
k = 0;
strcpy(what[i].comments[k], buffer);
printf("%s", what[i].comments[k]);
k = 1;
}
else if (strstr(buffer, "*") && strlen(buffer) > 3)
{
strcpy(what[i].comments[k], buffer);
printf("%s", what[i].comments[k]);
k++;
}
else if (strstr(buffer, "END"))
{
printf("\n");
i++;
}
}
else
{
printf("There is no file ");
}
// concatenate the name of the subdirectory onto the beginning of the file name
if ((pnew = fopen(strcat("Individual\\", x), "w")) != NULL)
{
// subdirectory exists, so continue with logic
}
else
{
// doesn't exist, try to create if it doesnt create then throw error
int j = 1;
while (j<4)
{
fprintf(pnew, "\t%s", what[i].comments[j]);
j++;
}
fclose(pnew);
}
if (pstudent != NULL)
fclose(pstudent);
}
else
{
printf("No command line args specified");
}
return 0;
}