zadanie2 works well in sequential

master
Peter Babič 9 years ago
parent 052092ee8a
commit 9520b45851
  1. 4
      zadanie2.c

@ -26,16 +26,20 @@ int main(void) {
int cols;
while (fgets(strBuffer, sizeof strBuffer, ptrFile) != 0) {
// Grow the buffer when needed
if (sizeBufferUsed == sizeBufferTotal) {
sizeBufferTotal *= GROWTH_FACTOR;
arrNumbers = my_realloc(arrNumbers, sizeBufferTotal * sizeof(int));
}
// store the pointer
ptrBuffer = strBuffer;
cols = 0;
// Read untill newline
while (*ptrBuffer != '\n') {
// Convert string to base 10
numValue = strtol(ptrBuffer, &ptrBuffer, 10);
// Store the number read in memory
arrNumbers[sizeBufferUsed++] = numValue;
cols++;
}

Loading…
Cancel
Save