Foros del Web » Programación para mayores de 30 ;) » C/C++ »

[Duda] Tecla Enter... en C y windows

Estas en el tema de [Duda] Tecla Enter... en C y windows en el foro de C/C++ en Foros del Web. Hola Tengo una duda existencial con la extraña tecla mas famosa del teclado D: la tecla enter ... que genera estos dos caracteres --> "\r\n" ...
  #1 (permalink)  
Antiguo 31/10/2012, 23:08
 
Fecha de Ingreso: julio-2009
Mensajes: 36
Antigüedad: 14 años, 9 meses
Puntos: 0
Pregunta [Duda] Tecla Enter... en C y windows

Hola
Tengo una duda existencial con la extraña tecla mas famosa del teclado D:
la tecla enter ... que genera estos dos caracteres --> "\r\n" (tienen otro nombre pero en C tienen ese identificador)
"Retorno de carro"... carácter no irreprimible de ascii... numero decimal: 13
"Salto de linea"... carácter no irreprimible de ascii... numero decimal: 10

El problema es en windows (-_- tengan paciencia)
Código C:
Ver original
  1. #include <stdio.h>
  2. int main(){
  3. inicio:
  4. printf("%d\n",getchar());
  5. fflush(stdin);
  6. goto inicio;
  7. return 0;
  8. }

Si se da a la tecla enter imprime el maldito 10 '\n' (lindo salto de linea)
pero en este codigo... cargando...

Código C:
Ver original
  1. #include <stdio.h>
  2. #include <conio.h>
  3. int main(){
  4. inicio:
  5. printf("%d\n",getch());
  6. fflush(stdin);
  7. goto inicio;
  8. return 0;
  9. }
Si se preciona la tecla enter imprime el raro 13 ... '\r' retorno de carro
Alguien me podria porfaaavor explicar que pasa....
  #2 (permalink)  
Antiguo 31/10/2012, 23:14
 
Fecha de Ingreso: julio-2009
Mensajes: 36
Antigüedad: 14 años, 9 meses
Puntos: 0
Respuesta: [Duda] Tecla Enter... en C y windows

Demonios!! al escribir la pregunta la respuesta llego a mi xD

¿me pueden borrar el tema? D: ... y aprovecho de contestarme solo (por si no se puede borrar)

En el primer codigo se imprime al carácter que se escribe en pantalla... un salto de linea por que el retorno de carro solo regresa al margen derecho... luego se agrega el salto de linea y se imprime el numero de ese carácter... \n=10=salto de linea

En el segundo se imprime el primer carácter que se encuentra. (en este caso no desaparese el \r al ser rescrito con \n como en el anterior, no hay tiempo) Enter genera "\r\n"=13-10 (en windows, en linux es solo 10 y en mac solo 13 xD)
... retorna un 13 ... retorno de carro.

Mi Pregunta fue tonta... Verguenza^Gugol !!! D:

Última edición por m4rc05; 31/10/2012 a las 23:23
  #3 (permalink)  
Antiguo 01/11/2012, 00:13
 
Fecha de Ingreso: octubre-2012
Mensajes: 1
Antigüedad: 11 años, 5 meses
Puntos: 0
Hermes Kelly Bag

If you wish to magnetize numerous people who your dressing up then you need to go through recent vogue movement. It is additionally critical that while in the efforts of shopping more desirable you can't make any kind improper preference. You ought to go for people items only which not only represent up to date pattern but in addition [url=http://www.newhermesoutlet.com/]Hermes Outlet[/url] match up with your individuality.

This truth is pertinent to garments, rings, make-up solutions as well as on the ladies handbag. For most of the still left possibilities there's assortment for making very good assortment and far better sources of information. But in terms of bag then it is entirely assured you're at the ideal place.

It is easy to understand that now-a-nights, when you think that about the finest selection of handbag almost all of the girls desire to get Hermes birkins and Hermes Kelly felix. If you possibly could apply for an excellent wide variety in the favorite purse then it can simply supply you a fantastic morning for browsing!

This can be the very same which you'll want to quickly apply for from Eurohandbag. It's an website which could compensate you with the chance to look for tote on the internet.

In case you are within the seek out many different Hermes birkins then you can definitely select this website as an excellent method with no uncertainty. The attractive element from it is you can purchase to find the best top quality ladies handbag by sitting at your home. Take a look at required journey a length and shop for it. If you are fond of Hermes Kelly felix then also this web site offers you special assortment within this type of purse.

Superior product or service provided by [url=http://www.newhermesoutlet.com/]Hermes Bag[/url] Eurohandbag will not be confined to Hermes birkins and Hermes Kelly only but you could get a similar with all the kinds of bag. Just what is the root of it? Why Eurohandbag is surely an unparalleled selection for a lot of targeted traffic if it is in regards to the items available from the tote sector? There are probably the factors that cause it which can observe as under.

Etiquetas: enter, int, tecla, windows
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 10:41.