I need to create a program that reads a whole bunch of info from one file and then writes it into another in a formatted columns such as name store no. amount sold etc
----- ----- ---------- ----
b 2
c 1
etc here is the code I have so far and I am stuck because the info in bagel.seq has no name so do I need to create a struct for the bagel.seq and if so how do I do that. I hope someone understands this I need to get done by tomorrow. I have been working and researching but I am stuck.
Code:
// filebagel.cpp : main project file.
#include "stdafx.h"
#include <stdio.h>
int main()
{
typedef struct
{
int store no.
char bagel description
double bagel price
int no. sold
}bagelreport;
bagelreport report;
FILE = *ptr_report;
FILE= *ptr_bagel;
if((ptr_bagel= fopen("Bagel.seq","r"))==NULL)
{
printf("\a\afile could not be opened\n");
}
if((ptr_report=fopen("report.rpt","w"))==NULL)
{
printf("\a\aFile could not be opened\n");
}
while(!feof(ptr_bagel && ptr_report){
fprintf(ptr_report,"%d%s%d%d",&report.srore no,report. bagel description, report.bagel price, report. no sold);
fscanf(ptr_bagel,"%d%s%d%d");