Machine_Shadow Posted June 11, 2008 at 08:35 AM Report Share #190670 Posted June 11, 2008 at 08:35 AM Como usar esta função? ? :S Link to comment Share on other sites More sharing options...
Baderous Posted June 11, 2008 at 09:03 AM Report Share #190673 Posted June 11, 2008 at 09:03 AM http://www.cplusplus.com/reference/clibrary/cstdio/gets.html Link to comment Share on other sites More sharing options...
Rui Carlos Posted June 11, 2008 at 09:19 AM Report Share #190675 Posted June 11, 2008 at 09:19 AM Não usas! Tens o fgets do C, mas parece-me que em C++ tens métodos como o getline que faz mais sentido usar... Rui Carlos Gonçalves Link to comment Share on other sites More sharing options...
pedrotuga Posted June 11, 2008 at 11:52 AM Report Share #190697 Posted June 11, 2008 at 11:52 AM Yaps, em C++ há outros métodos, nomeadamente nem é preciso andar com funções para trás e para a fente, basta abrir uma stream e usar os operadores insersor << e extractor >> Tens aqui um exemplo: http://www.fredosaurus.com/notes-cpp/io/readtextfile.html Quanto à função fgets está aqui um exemplo no nosso wiki, na secção de C: http://wiki.portugal-a-programar.pt/dev_geral:c:ficheiros Link to comment Share on other sites More sharing options...
Machine_Shadow Posted June 13, 2008 at 09:31 AM Author Report Share #191040 Posted June 13, 2008 at 09:31 AM o meu problema é que o gets () usaria para pedir algo ao utilizador, podendo ele usar " "(espaços), mas há alguns programas em que implemento esta função que pura e simplesmente não funciona. Obrigado a todos na mesma 👍 Link to comment Share on other sites More sharing options...
Rui Carlos Posted June 13, 2008 at 10:08 AM Report Share #191042 Posted June 13, 2008 at 10:08 AM Provavelmente os problemas ocorrem quando deixa caracteres no buffer. Rui Carlos Gonçalves Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now