PsySc0rpi0n Posted August 25, 2013 at 01:26 PM Report #522598 Posted August 25, 2013 at 01:26 PM Ainda não consegui perceber quando é que os '\n' influenciam negativamente o nosso code... Por exemplo, eu tenho insto no meu code e não está a funcionar fgets(&ch, 1, stdin); mas se colocar: scanf(" %c", ch); já funciona... Expliquem-me isto de uma vez por todas... Mesmo colocando while(getchar() != '\n') antes e depois do fgets, não funciona... Kurt Cobain - Grunge misses you Nissan GT-R - beast killer
thinkabout Posted August 25, 2013 at 04:09 PM Report #522609 Posted August 25, 2013 at 04:09 PM (edited) Se a memória não me falha tens que por o fgets com 2, pois tens sempre que dar mais um por causa do \n. Edited August 25, 2013 at 04:09 PM by thinkabout
PsySc0rpi0n Posted August 25, 2013 at 04:14 PM Author Report #522610 Posted August 25, 2013 at 04:14 PM hum, ok... Kurt Cobain - Grunge misses you Nissan GT-R - beast killer
Rui Carlos Posted August 25, 2013 at 05:05 PM Report #522612 Posted August 25, 2013 at 05:05 PM Se só queres um caracter, devias usar o fgetc (ou mesmo o getc) e não o fgets. Rui Carlos Gonçalves
HappyHippyHippo Posted August 25, 2013 at 08:00 PM Report #522624 Posted August 25, 2013 at 08:00 PM Ainda não consegui perceber quando é que os '\n' influenciam negativamente o nosso code... devido a isto : https://www.portugal-a-programar.pt/topic/61667-lista-telefonica-estruturas/?do=findComment?comment=522621 IRC : sim, é algo que ainda existe >> #p@p Portugol Plus
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