hi guys...my code works fine, just when i want to put a longer path as input my programm chrashed... maybe the buffer for my string path; is too small? how can i handle this? C:\test.txt works fine but when the input is like that C:\Dokumente und Einstellungen\xxxxx\Desktop\test.txt it will chrash every time...

.
.
.

  string path;                     
  cout<<"Bitte geben Sie den Quellpfad der Text Datei an:\n\n";
  cin>>path;                       
  getchar();

.
.
.

That path contains spaces, so you can't use the >> operator. use getline() instead to get the full path including all spaces.

thanks now at works ;) Have another problem with my sort function, everything works fine with sort and output of " Text " input... just when i use words with this letters ä, ü, ö... how can i fix that? do you have a idea?

string path;                     
cout<<"Bitte geben Sie den Quellpfad der Text Datei an:\n\n";
getline( cin, path );        

	ifstream myfile (path.c_str());
	if (myfile.is_open()) {      
	while(myfile.read(&c,1)) {
	if(isalpha(c))
	in+=tolower(c);
	else if(!in.empty()) {
	++count[in];
	in.clear();
		}
	 }

for (MapType::iterator i=count.begin(),j;i!=count.end();i=j) {  

	char next_key[]={i->first[0],i->first.size() > 1 ? i->first[1]+1 : '_'};
	j=count.lower_bound(next_key);
	cout<<string(i->first,0,2)<<" - ";
	MapType::iterator k=j;--k;
	do {
		cout<<k->first;
                        if(k->second>1)
		cout<<" ("<<k->second<<")";
		if(k!=i)
		cout<<", ";
	}	while(k--!=i);
		cout<<endl;
        }
    }
		else cout << "Datei konnte nicht geoeffnet werden!"; 
		getchar();
		return 0;
}

I'm a little confused about what you are asking. Are you saying your sort algorithm works ok with English words, but not with words that use alphabets from other languages ? If that is correct then I'm afraid I can't be much help. You might research the SetLocal() function, or some associated function(s)

hmm yes something like this

locale german_loc("de"); collate<char>& col = use_facet<collate<char> >(german_loc);

and with the col i have to compare??

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.