Iam reading in a file which has a strings like
This_Is_the_string
I would like to replace ever _ with a <space>. How would i go about this ?
This is the code i have so far and attached is the file am reading in. You can view another thread with the full code Here
Code:void fillTable(StockTable& p) { FILE* StockData; int tmpAmount,pos; long int tmpID; char tmpDes[30]; float tmpPrice; StockData = fopen("stock.txt","rt"); if(!StockData) { cout<<"Error opening file..."; exit(1); } cout<<"Creating table...\n"; while (fscanf(StockData, "%D\t%s\t%f\t%d", &tmpID, tmpDes,&tmpPrice,&tmpAmount) == 4) { pos = hashKey(tmpID); strupr(tmpDes); p.list[pos].intCatNumber = tmpID; strcpy(p.list[pos].strDescription, tmpDes); p.list[pos].intPrice = tmpPrice; p.list[pos].intQuantity = tmpAmount; } fclose(StockData); }