ios::app 'ios' has not been declared error.

Hi, I get an error in the following code on line 9: 'ios' has not been declared. I'm using a Code::Blocks IDE if that helps.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <iostream>
#include <fstream>
int main()
{
    std::ifstream read("List.txt");
    int x;
    while (read >> x)
        std::cout << x << std::endl;
    std::ofstream print("List.txt", ios::app);
    do
    {
        std::cin >> x;
        if (x)
            print << x << std::endl;
    }
    while (x);
}


If anyone has any idea why this doesn't work, please let me know, thanks!
That should be
std::ios::app
. All standard library stuff is in the std namespace.
I knew it was something silly... Thank you!
You're welcome :)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <iostream>
#include <fstream>
int main()
{
    std::ifstream read("List.txt"); // Потік щоб читати і писати з / у файли
    int x;
    while (read >> x)
        std::cout << x << std::endl;
    std::ofstream print("List.txt", std::ios::app);   // Потік писати на файли
    do
    {
        std::cin >> x;
        if (x)
            print << x << std::endl;
    }
    while (x);
}
Тобто std::ios::app, так, принаймні, компилюється
Topic archived. No new replies allowed.