Hey guys I'm having a little problem with reading from a text file, here's how the text is formatted:
random string$52$44$5$abc
random string$52$44$5$abc_def
random string$52$44$5$abc_defgh
this code is what I use to read the text
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
char name[100][100];
char position [100][100];
//char position2[100][100];
int height[100],weight[100],teamnumber[100];
int index = 0;
void open(){
FILE*f = fopen ("data.txt","r");
if (fopen ("data.txt","r")==NULL){
puts ("File not found");
}else{
while(!feof(f)){
fscanf(f,"%[^$]$%d$%d$%d$%s\n",name[index],&height[index],&weight[index],&teamnumber[index],position[index]);
index++;
}
fclose(f);
}
}
now no matter what i do i can't get rid of the _ symbol from abc_def...
i want the last string output to look like this: abc def instead of abc_def..please help