AHHH!!!! my CINs were backwards. I wasnt sure if there were supposed to be quotes on the FILENAME. Thanx.
Phew, got it workind :D Just gotta fix the beast number problem and it will be...
Type: Posts; User: kamitsuna
AHHH!!!! my CINs were backwards. I wasnt sure if there were supposed to be quotes on the FILENAME. Thanx.
Phew, got it workind :D Just gotta fix the beast number problem and it will be...
// fileread.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <ctime>
#include <string>
#include <fstream>
using namespace std;
...
gotcha!
I double checked the code and all my semi colons and stuff seem to be right, its giving me errors out of the string include. Not sure, ill look at it again.
I think i understand what the #define function does...but whats the difference between string and define?
// fileread.cpp : Defines the entry point for the console application.
//
...
yeah, i was hoping to avoid that explaination. I got the integer thing. It was mostly just the concept i was worried about. Thanx for the clarification! Makes more sense to me now :D
what i mean is, how does the program know that name is the first line, role is the second line, and beastnumber is the third line?
Is it because thats the order you wrote the code in?
If, instead...
HA! This is what i was looking for. I will mess with this, thank you!
How does the program know that
getline(file, name);
getline(file, role);
num_of_beast = file.get();
comes in exactly...
I am using my "fake" game as a way to learn programming. All the code I have posted here (as i have said numerous times now) its merely to help me learn what i am doing. Its completely junk and will...
Back on topic :)
Here is the code i have now:
#include "stdafx.h"
#include <iostream>
#include <ctime>
#include <string>
#include <fstream>
well i thought what i was doing was reversing the process, but i guess it doesnt quite work that way.
Really what i did was just apply some values to some variables, then i posted an fout with...
I'd like to be able to talk to some programmers in real time. Anyone have suggestions for a good chat room to just go chop it up with some code monkeys?
hehe, im still lost on this topic....oh well, i think im just too new to coding to get it quite yet.
Basically i'm looking to (later on) start working on my own game. Right now, im just trying to...
Laserlight, I did look it up, thats how i knew it even existed. I'm just not sure how to use it yet. I'm new to c++ so the documentation starts to look like japanese to me, and i dont speak japanese....
I think i understand...sorta :D
You may have already seen my questions about how to output to a file, now that i have that sorted out, now's time to learn how to get it back!
i tried this
ifstream open((cName +...
so
(cName + ".text") basically reconstructs the string then
.c_str()formats it so then when the final code runs it looks like
ofstream fout (cName.txt);
That sound right?
I'm going to...
Oh i understand, i was close. Not sure i understand what c_str() is though.
c_str() is what formats the string of fout?
That worked just like i wanted. Thank you laserlight!
Thanks a bunch MK27!
So after playing with this a little bit i got it sorted out. Managed to export the data i was looking for to a file. My next question is how can i make the file name dynamic.
...
touche salesman
not to be a douche or anything, but every time someone asks a question that has already been asked...the default answer is always USE THE SEARCH BUTTON!
This person obviously used the search...
Like i said, i am reading the documentation but that my learning comes from seeing it in action and being able to work with it.
I'm not quite sure what to do with the fout command you posted....
hehehe, well im extremely new to c++ , hell extremely new to programming at all. I had a feeling that was going to be a bit beyond what i can understand quite yet.
Thank you very much for the...
If i have a program that collects a series of data from a user through cin commands, is it possible to take the product of those inputs and save them to say...a text file to be called upon later if...
yeah, in my program they match up right, when i copied and pasted a lot of it sorta formatted a bit off. So it just looks like i missed a close...hmmm ive been over it a bunch of times and i dont see...
I am getting an error in my debugging that i dont understand. I dont even know how to end code yet...I'm 2 days into learning C++ so im not even sure the last section is correct yet.
This is the...