Hi experts,
i am facing this error in runtime
debug assertion failed!
FILE fgets.c
line 60
Expression str!= NULL
my code is pasted below can anyone help me?
Code:
/* Include files */
#include <stdio.h>
#include <uf.h>
#include<stdio.h>
#include<conio.h>
#include<uf.h>
#include<uf_csys.h>
#include<uf_ui.h>
#include<uf_curve.h>
#include<uf_vec.h>
#include<uf_part.h>
#include<uf_drf.h>
#include<string.h>
#include<stdlib.h>
#include<uf_defs.h>
#include <ERRNO.H>
#include <direct.h>
#include <math.h>
#include <io.h>
#include <stdarg.h>
#include <time.h>
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <sys/stat.h>
#include <assert.h>
static void my_block();
extern void main( char argc, char *argv[] )
{
my_block();
}
static void my_block()
{
FILE *fp;
float x,y,z;
long int i=0,n=0,j=0,k=0;
char buf1[1000];
double x_cor[5];
double y_cor[5];
double z_cor[5];
const char *str1;
tag_t part;
struct point{
double pt[3];
};
int no_of_section,no_points,count=0;
int degree=3;
int periodicity=0;
int save_def_data = 0;
int num_points=5;
struct point tempPts;
tag_t spline_tag=NULL_TAG;
UF_CURVE_pt_slope_crvatr_t point_data[5];
//buf1 = (char *)malloc (sizeof(char*));
fp = fopen("D:\\Backup_QI-287\\GEConfidential\\rajesh\\material_code_table\\javed\\Runner_Blade.txt", "r");
//(fgets(line, 80, fr) != NULL)
while (((str1 = fgets( buf1, 1000, fp ))!= NULL)&&(k != EOF ))
{
i = strlen(buf1);
//printf("\n Final val : %d",i);
if(n==1)
{
sscanf(str1,"%d %d",&no_of_section,&no_points);
printf("\n No of Section: %d\n",no_of_section);
printf("\n No Points: %d\n",no_points);
}
if(n>1)
{
sscanf(str1,"%f %f %f",&x,&y,&z);
//printf("\n Final val : %.3f %.3f %.3f",x, y, z);
tempPts.pt[0]=x;
tempPts.pt[1]=y;
tempPts.pt[2]=z;
j++;
printf("\n Final val : %.3f %.3f %.3f",tempPts.pt[0],tempPts.pt[1],tempPts.pt[1]);
printf("\n no of line :%d",j);
}
n++;
}
fclose(fp);
/*
UF_PART_new("D:\\Pract\\shspline\\d5.prt",1,&part);
UF_CURVE_create_spline_thru_pts ( degree, periodicity, num_points, point_data, NULL, save_def_data, &spline_tag );
UF_PART_save( );*/
printf("\nhi i m in block\n");
}