Can't Find the File and Can't Find the Namespace

Two problems.

1. When I do the richTextBox1->LoadFile("FILENAME") method, it tells me that the file I entered doesn't exist, while it really does. I'm not even sure if this is the way to load a file into the richTextBox, but I did it because that's how it worked in VB.net.

2. When I try to convert a string ("3") into an integer using System::Convert::ToInt32, it says that 'following :: must be a namespace name'. It worked at first, but all of a sudden, no matter which computer I'm on, it throws the error. While I have found an alternative solution, I want to know why this is happening.

Thanks in advance. (I put two questions in one post because this forum takes way to long to load and I didn't want to bother posting two threads.
at the start of program type using namespace std; like this
1
2
3
4
5
6
#include <iostream>
#include <whatever>
using namespace std;

int main()
...
Also, while using using namespace std; you may come across redefinitions. There's an already created function inside the header file you include and you've created a function of the same name.

One I can think of, off the top of my head, is count. I've seen this a few times.

One way around this, it to use std::.

i.e.
1
2
3
4
5
6
7
8
9
10
#include <iostream>

//NB: here, I'm not using using namespace std;

int main()
{
    std::cout << "Hello world...\n";

    return 0;
}


Also, you could 'define' what you'll be using;
1
2
3
4
5
6
7
8
9
10
11
#include <iostream>
#define cout std::cout

//NB: here, I'm not using using namespace std;

int main()
{
    cout << "Hello world...\n";

    return 0;
}
Last edited on
I already have the 'using namespace std;' line in my coding. But that's not really my problem...unless 'std' has something to do with the System:: namespace...but I don't know what 'std' stands for.
There is no System:: namespace in C++. If you find you're using that, you might find faster responses in a forum where the Microsoft's proprietary C++/CLI language is topical.

google suggests that http://msdn.microsoft.com/en-us/library/system.convert.aspx?cs-save-lang=1&cs-lang=cpp#code-snippet-2 may be of interest to you for question 2. Google also has interesting links for question 1.
I'm sorry if I used the wrong term, but if I try System::, it throws that error. I don't understand what exactly the error means, why it sometimes appears (and sometimes doesn't), or how I can fix it.

EDIT: I just saw the MSDN link, but Google Chrome can't connect to MSDN no matter what I do :(
Last edited on
Topic archived. No new replies allowed.