So, for the past two days, I've been trying to wrap my head around this.
I've done searches with google, and learned about new functions being made inside of switch cases, and I've tried something else with a prototype function.
Basically, I'm wanting to write from the ground up a time scheduler with reminder application to help me stay on task while at my work pc, I've got things to do at certain hours and an on screen reminder to switch to something would be nice. I'm wanting to use a text file to store said reminders, and when it reaches a certain time in the day, it will read off that scheduled reminder in something like python having dialog windows to pop to screen.
This is a switch case statement and I'm having trouble getting my .txt file calls and handles to work like they should, but when I put calls to print to screen and carriage returns, those work straight from the prototype calls. A little help with getting it to work would be much appreciated.
TLDR; Also used if/else statements and it still didn't work...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
/*
int write(){
ofstream myfile;
myfile.open("derp.txt",ios::app);
string a;
getline(cin,a);
myfile<<a<<endl;
myfile.close();
return 0;
}
int main(){
cout<<"Enter your derp: 1 for derp, 2 for nah\n";
int choice;
cin>>choice;
switch(choice)
{
case 1:
cout<<"New selected!\nEnter new derp\n";
write;
break;
case 2:
cout<<"Nah selected\n";
break;
}
}
*/
|
I've tried this out on Code::Blocks most recent stable release on both Windows 7x64 and Windows 8.1x64. I've tried to do the file handling directly in the switch case blocks and inside if/else statements.
As far as research goes, I've went to codebrother, this site for both file handling and switch case information and geeksforgeeks.