I'm looking for assistance on a program I'm making. Essentially I have to read in a set of points, alter them, and then print them out on a separate text file. Reading/Reprinting is no problem. I'm having trouble with the alterations.

The first three sets of data from the text files are three separate points (x,y,z). What I need to do is subtract these three points from the next three points (x2, y2, z2) then subtract that value from the following set of points (x3, y3, z3) and so on down the chain. Think of it as moving from one point, to a new point, to a new point.

I feel like I'm overlooking something obvious, but everything I've tried thus far hasn't worked out. Any help is appreciated.

Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>


#define MAX_STRING_LENGTH 100


 /*
  *
  */


typedef struct Vector Vector;
struct Vector {
	float x;
	float y;
	float z;
};


void getVectorFromString(char string[], Vector *vector);
void writeVectorToFile(Vector vector, FILE *file);




int main(int argc, char** argv) {


	char currentLine[MAX_STRING_LENGTH];
	int numLines = 0;


	FILE* inputFile = fopen("points.txt", "r");
	if (inputFile == NULL)
	{
		printf("File open failed\n");
		return (EXIT_FAILURE);
	}


	while (!feof(inputFile))
	{
		fgets(currentLine, MAX_STRING_LENGTH, inputFile);
		numLines++;
	}


	rewind(inputFile);


	Vector* vectors = malloc(numLines * sizeof(Vector));
	for (int i = 0; i < numLines; i++)
	{
		fgets(currentLine, MAX_STRING_LENGTH, inputFile);
		getVectorFromString(currentLine, &vectors[i]);
	}


	fclose(inputFile);




		FILE *outputFile = fopen("moveinfo.txt", "w");
		if (outputFile == NULL)
		{
			printf("File open failed.\n");
			return (EXIT_FAILURE);
		}


		for (int i = 0; i < numLines; i++)
		{
			writeVectorToFile(vectors[i], outputFile);
		}


		fclose(outputFile);




	return (EXIT_SUCCESS);
}






void getVectorFromString(char string[], Vector *vector)
{
	int commaIndex = -1;
	char *result = NULL;
	result = strchr(string, ',');
	char * stringStart = &string[0];
	commaIndex = result - stringStart;


	char* numberString = malloc((commaIndex + 1) * sizeof(char));
	strncpy(numberString, string, commaIndex);
	numberString[commaIndex] = '\0';
	vector->x = atof(numberString);


	string = &string[0] + commaIndex + 1;
	result = strchr(string, ',');
	stringStart = &string[0];
	commaIndex = result - stringStart;


	char* numberString2 = malloc((commaIndex + 1) * sizeof(char));
	strncpy(numberString2, string, commaIndex);
	numberString2[commaIndex] = '\0';
	vector->y = atof(numberString2);


	string = &string[0] + commaIndex + 1;


	vector->z = atof(string);






	free(numberString);
	numberString = NULL;
	free(numberString2);
	numberString2 = NULL;


}


void writeVectorToFile(Vector vector, FILE *file)
{
	fprintf(file, "%.4f,%.4f,%.4f", vector.x, vector.y, vector.z);
}