using namespace std;
string mine;
ifstream myFile("file.txt", ios::in);
getline(myFile, mine, '\n');
Type: Posts; User: LiKWiD
using namespace std;
string mine;
ifstream myFile("file.txt", ios::in);
getline(myFile, mine, '\n');
As a side note, strings use the format
getline(cin, blah, '\n');
rather than
remove(filename.c_str());
rename("temp.ini", filename.c_str());
It wasn't working in my proggie at first because I hadn't closed the files before trying to rename/remove them. Everything works...
If you want to simply make it unreadable by your friends, output the characters to your file as mrafcho001 said, then create a program to 'decode' the same. I believe you can find what a space is by...
Well, first of all I tried using these in my function and it doesn't seem to do anything. That, I'm sure, can be worked out. However, if I'm not mistaken these are C functions. I've searched and...
Well, I'm not sure that your question was worded extremely well, but of course a character doesn't become an integer just because.
Thanks for all the help. I learned a lot messing with arrays, but in the end I looked at my code and thought I should rewrite it with STL strings. It is much easier to deal with (IMO) and so far it...
Well, that didn't take long. I am not sure how to add a character to my string. I'm trying to add aline[y] to string div_check.
char div_check[30];
. . .
div_check += aline[y]; //also...
I changed
ofstream ini_write ((strcat("temp",filename)), ios::out);
to
Well, my program compiles right, but crashes when I try to run it.
*Long Code Ahead*
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <cstring>
Sweet, works now. Thanks. I guess I don't understand how they work too terribly well. I'm also having trouble appending characters to the end of a string. This is what I have:
...
I am writing a function, and I'm getting the error "invalid conversion from 'char' to 'const char*'" when I try to compile. Any help would be appreciated. :)
char aline[125];
char sline[125];...
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <fstream>
using std::cout;
using std::cin;
using std::ifstream;
using std::ofstream;
using std::ios;
Anybody know why I'd be getting a linker error like that?
Ok, I reinstalled all of GTK+ and gtkmm, and it gets farther in compilation this time. However, I'm still getting errors. This time from the linker:
[Linker error] undefined reference to...
It gives me errors such as:
29 In file included from C:/dev-cpp/include/gtkmm/include/gtkmm-2.0/gtkmm.h
25 C:\dev-cpp\include\gtkmm\include\gtkmm-2.0\glibmm.h glibmmconfig.h: No such file...
Ok, I realize this isn't directly a C++ problem, but it concerns it, and I'm not sure where else to get help on it. I'll jump right to my question: I am trying to setup GTK+ (2.4 I believe) to work...
So, do I have to setup the Windows .. "stuff"? (I've tried Windows programming, but never done much with it since you had to add all the code at the beginning to set it up.) i.e., What do I need to...
I would like to know how to change the icon of my program (console application) from the default whiteboard-thing to an icon of my choice. Any 'n all help is appreciated. Thanks.
--mr0ldie
it worked fine when I compiled it...
Well, I removed rem when I changed it up a bit. I had it in there before to basically discard a couple extra variables the person may have entered (since my program can only calculate 4 variables)....
Ok, I changed up a lot of the code. Thanks to froggy I have...
const char add = '+';
const char subtract = '-';
const char multiply = '*';
const char divide = '/';
You will also need to add cin.ignore() after cin>>choice. It will get rid of the return at the end of the string, so your first getline in the IF (whichever is executed) won't be empty.
Hey, thanks for the suggestions.
If I use a switch, I still have to set up an IF similar to what I have to tell it which case to use, correct?
Ahh, pointers. I hadn't thought to use those....
Sorry, I don't mean to waste anybody's time. I really don't have a problem, I'm simply asking for suggestions if people have the time...
--LiKWiD
Becoming un-noobified one day at a time.