Predmet:Re: C+ ucitavanje txt datoteke sa čžš slovima
Treba pretvoriti u char da bi radilo.
PreuzmiIzvorni kôd (C++):#include <iostream>
#include <fstream>
#include <string>
#include <windows.h>
using namespace std;
int main () {
string redak;
SetConsoleOutputCP(1250);
ifstream test ("sluzbe.dat");
if (test.is_open())
{
while (! test.eof() )
{
getline (test,redak);
char *kar = new char[redak.length() + 1];
strcpy(kar, redak.c_str());
AnsiToOem(kar, kar);
cout << kar << endl;
}
test.close();
}
else cout << "Ne mogu otvoriti datoteku";
system ("PAUSE");
return 0;
}
Podrska samo putem foruma, jer samo tako i ostali imaju koristi od toga.
Ovaj post je ureden
1
puta. Posljednja izmjena 25.02.2016 11:47 od strane Avko.