Does anyone know if there is any restriction on using fscanf
in projects that use GLUT (OpenGL)? I'm trying to do something simple ... read a cloud of points (x, y, z) from a text file, but fscanf
does not get the values correctly ... The same code in a console application in the code :: blocks works correctly.
Does anyone have any suggestions for what I may have done wrong?
Code:
#include <windows.h>
#ifdef __APPLE__
#else
#include <GL/glut.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <conio.h>
int main()
{
int i;
int v1x;
int vetor[9]; // 3 points
FILE *occluded_triangles;
occluded_triangles = fopen("occluded_triangles.txt", "rt");
for(i = 0; i < 9; i++)
{
fscanf(occluded_triangles, "%d", &v1x);
vetor[i] = v1x;
}
for(i = 0; i < 9; i++)
{
printf("%d\n", vetor[i]);
}
system("pause");
return 0;
}