Remove accent from a string in C language

Asked

Viewed 321 times

2

I’ve got a college paper on Threads and competition control (Openmp) in C, which is giving me a bit of a headache.

The job is to take a text from any file and separate it between Threads producers and consumers, where consumers will count the occurrence of a word on a line and account for a variable shared between threads.

The problem is not even in the main focus that are the Threads and control itself, but in the pre-processing of the text, I have to remove accents and special characters.
I’ve tried it anyway but I couldn’t map the two char positions (wchar that are defined, if I’m not mistaken) that hold that kind of character. Has anyone ever done any kind of conversion?

Direct comparison does not work and even using "strcmp". Can you help me? Remembering that it is in C and not C++.

In short, given a string in C, you need to remove accents and special characters as an example:

char texto[] = "téxtô açentûádo";

//processo de remoção de acentos e caracteres especiais.  
puts(texto); //retorna "texto acentuado" ao invés de "téxtô açentûádo"
  • I believe that this question was improperly closed for the reason given. It is not too wide, however I believe that there may be duplicates around.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.