Click here to Skip to main content
15,891,136 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: string parsing Pin
Richard MacCutchan23-Nov-11 22:14
mveRichard MacCutchan23-Nov-11 22:14 
AnswerRe: string parsing Pin
Stefan_Lang24-Nov-11 23:17
Stefan_Lang24-Nov-11 23:17 
QuestionRe: string parsing Pin
David Crow26-Nov-11 6:44
David Crow26-Nov-11 6:44 
QuestionEscape out double quote Pin
jkirkerx23-Nov-11 10:12
professionaljkirkerx23-Nov-11 10:12 
AnswerRe: Escape out double quote Pin
Albert Holguin23-Nov-11 10:42
professionalAlbert Holguin23-Nov-11 10:42 
AnswerRe: Escape out double quote Pin
Graham Breach23-Nov-11 10:43
Graham Breach23-Nov-11 10:43 
GeneralRe: Escape out double quote Pin
jkirkerx23-Nov-11 11:07
professionaljkirkerx23-Nov-11 11:07 
QuestionReading Save File Problem Pin
idbee2k323-Nov-11 9:13
idbee2k323-Nov-11 9:13 
Dear All,
The code below is C Programming that i wrote and is working but I am having problem in reading any records I am saving into text File called "MY FILE".Also anytime to ADD NEW RECORD in my switch case selection,the initial record that was in the is been deleted automatically.Did any one know what is wrong.I can figure it out,i have been tried debugging but all to no avail.I will appreciate your ideas.Thanks

***********************************************************'''''****
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define SIZE 10

#define Income_type 8

#define Expense_type 7





typedef struct{

int day;

int month;

int year;

}Date_of_transaction;



typedef struct{

int type_transaction;

char desc_transaction[80];

float amount_of_money;

Date_of_transaction date;

}Trecord;



typedef struct{

Trecord r;

}Tarray;


int count(int *count);


void add_new_record(Trecord records,Tarray t[],int *counter,int *count);

void read_data_from_disc(Trecord *records);

void save_curiculum_to_disc(Tarray records[]);

void add_money(Trecord *records);

void spend_money(Trecord *records);

void print_a_report(Tarray *records,int *counter);

void delete_a_record(Trecord *record);

void initialize(Trecord records);

void initializeRecord(Tarray records[]);



int main(int argc, char** argv) {



int quit = 0;

int choice = 0;
static int counter = 0;
int count = -1;

Trecord records;

Tarray recordData[SIZE];


initializeRecord(recordData);

while(!quit) {

printf("\nChoose an option:\n"

"1. Add New Record\n"

"2. Read Data from File\n"

"3. Save Data to File\n"

"4. Print Report\n"

"5. Quit\n" );

scanf("%d", &choice);



switch(choice){

case 1:

count++;
add_new_record(records,recordData,&counter,&count);
printf("%d",count);


break;



case 2:

read_data_from_disc(&records);

break;



case 3:

save_curiculum_to_disc(recordData);

break;

case 4:


count++;
print_a_report(recordData,&count);

break;



case 5:

quit = 1;

break;



default:

printf("Invalid Selection\n");

}

}



return (EXIT_SUCCESS);
}






void initializeRecord(Tarray records[]){

int i;


for(i=0;i

modified 26-Nov-11 12:57pm.

SuggestionRe: Reading Save File Problem Pin
Albert Holguin23-Nov-11 9:31
professionalAlbert Holguin23-Nov-11 9:31 
AnswerRe: Reading Save File Problem Pin
David Crow26-Nov-11 6:50
David Crow26-Nov-11 6:50 
QuestionUsing Main to grab command line arguments if it doesn't already exist? Pin
Lucidation23-Nov-11 6:15
Lucidation23-Nov-11 6:15 
AnswerRe: Using Main to grab command line arguments if it doesn't already exist? Pin
Albert Holguin23-Nov-11 7:21
professionalAlbert Holguin23-Nov-11 7:21 
AnswerRe: Using Main to grab command line arguments if it doesn't already exist? Pin
Chris Meech23-Nov-11 7:22
Chris Meech23-Nov-11 7:22 
AnswerRe: Using Main to grab command line arguments if it doesn't already exist? Pin
Chuck O'Toole23-Nov-11 7:43
Chuck O'Toole23-Nov-11 7:43 
AnswerRe: Using Main to grab command line arguments if it doesn't already exist? Pin
Software_Developer23-Nov-11 7:52
Software_Developer23-Nov-11 7:52 
AnswerRe: Using Main to grab command line arguments if it doesn't already exist? Pin
Chris Losinger23-Nov-11 8:41
professionalChris Losinger23-Nov-11 8:41 
AnswerRe: Using Main to grab command line arguments if it doesn't already exist? Pin
Chuck O'Toole23-Nov-11 9:36
Chuck O'Toole23-Nov-11 9:36 
QuestionBit Fielf In UML Pin
Member 842679823-Nov-11 0:29
Member 842679823-Nov-11 0:29 
AnswerRe: Bit Fielf In UML Pin
Software_Developer23-Nov-11 0:43
Software_Developer23-Nov-11 0:43 
GeneralRe: Bit Field In UML Pin
Member 842679823-Nov-11 1:13
Member 842679823-Nov-11 1:13 
GeneralRe: Bit Field In UML Pin
Software_Developer23-Nov-11 3:24
Software_Developer23-Nov-11 3:24 
GeneralRe: Bit Field In UML Pin
Member 842679824-Nov-11 7:05
Member 842679824-Nov-11 7:05 
GeneralRe: Bit Field In UML Pin
Member 842679825-Nov-11 21:23
Member 842679825-Nov-11 21:23 
QuestionDoesn't open heading file VC ++ Pin
PeLeg8922-Nov-11 23:55
PeLeg8922-Nov-11 23:55 
AnswerRe: Doesn't open heading file VC ++ Pin
Richard MacCutchan23-Nov-11 0:04
mveRichard MacCutchan23-Nov-11 0:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.