
13.12.2009, 02:38
|
|
Новичок
Регистрация: 12.12.2009
Сообщений: 13
Провел на форуме: 51050
Репутация:
0
|
|
# cat list.c
Код:
#include <iostream>
#include <string>
#include <fstream>
int main (int argc, char* argv[]) {
std::string source, line, uin, pass;
std::ifstream uinFile("uin.txt");
std::ifstream passFile("pass.txt");
std::ofstream sourceFile("source.txt");
if (!uinFile.is_open()) {
std::cout << "Unable to open file uin.txt\n";
return 1;
}
if (!passFile.is_open()) {
std::cout << "Unable to open file pass.txt\n";
return 1;
}
if (!sourceFile.is_open()) {
std::cout << "Unable to open file source.txt\n";
return 1;
}
while (!passFile.eof()) {
line = "";
getline(passFile, pass);
while (!uinFile.eof()) {
getline(uinFile, uin);
line += uin + ";" + pass + "\n";
}
source += line;
uinFile.seekg(std::ios::beg);
}
sourceFile << source;
uinFile.close();
passFile.close();
sourceFile.close();
return 0;
}
# gcc -pthread list.c -o list
list.c:1:20: iostream: No such file or directory
list.c:2:18: string: No such file or directory
list.c:3:19: fstream: No such file or directory
list.c: In function `main':
list.c:6: error: syntax error before ':' token
list.c:7: error: syntax error before ':' token
list.c:8: error: syntax error before ':' token
list.c:9: error: syntax error before ':' token
list.c:10: error: `uinFile' undeclared (first use in this function)
list.c:10: error: (Each undeclared identifier is reported only once
list.c:10: error: for each function it appears in.)
list.c:11: error: syntax error before ':' token
list.c:14: error: `passFile' undeclared (first use in this function)
list.c:15: error: syntax error before ':' token
list.c:18: error: `sourceFile' undeclared (first use in this function)
list.c:19: error: syntax error before ':' token
list.c:23: error: `line' undeclared (first use in this function)
list.c:24: error: `pass' undeclared (first use in this function)
list.c:26: error: `uin' undeclared (first use in this function)
list.c:29: error: `source' undeclared (first use in this function)
list.c:30: error: `std' undeclared (first use in this function)
list.c:30: error: syntax error before ':' token
Какая версия компилятора я даже и незнаю...
Последний раз редактировалось slesh; 14.12.2009 в 10:30..
Причина: [code][/code]
|
|
|