Retorno de carro

Origem: Wikipédia, a enciclopédia livre.
(Redirecionado de Carriage return)

Em computação, retorno de carro, do inglês carriage return e também abreviado como CR é um caractere de controle que move o cursor para o início da linha[1], sem avançar para a próxima linha. Seu nome é inspirado no movimento das máquinas de escrever feito com a ajuda de uma alavanca para reposicioná-la no início da próxima linha ao atingir o final da atual[2][3]. Na tabela ASCII este caractere de controle possui o número decimal 13[4][1] e no EBCDIC é representado por X'15'[5].

Sua interpretação pode variar de acordo com o sistema operacional. No caso do Windows faz parte da sequência de caracteres de controle carriage return e line feed para indicar o início de uma nova linha. Já no caso dos sistemas tipo Unix a representação de uma nova linha é feita apenas com o caractere line feed[6].

Nas linguagens de programação é representado através de uma sequência de escape. Nas linguagens C[7], Java e Perl é usada a sequência \r[8]. Em terminais Linux ele é representado na notação com circunflexo por ^M (Ctrl+M)[9].

Referências

  1. a b «CRLF». MDN Web Docs. Consultado em 17 de março de 2021. CR = Carriage Return (\r, 0x0D in hexadecimal, 13 in decimal) — moves the cursor to the beginning of the line without advancing to the next line. 
  2. «carriage returns». Pratical Typography. Consultado em 17 de março de 2021. On manual typewriters, the carriage was the part on top that held the paper and scooted leftward as you typed. At the end of each line, you’d push a lever to move the carriage to the beginning of the next line. On electric typewriters, this lever became the carriage return key, which you’d press at the end of each line. 
  3. «carriage return». Cambridge Dictionary. Consultado em 17 de março de 2021 
  4. «The Carriage Return and Line Feed Characters». Daniel Miessler. 17 de dezembro de 2019. Consultado em 17 de março de 2021. The Carriage Return (CR) is represented by ASCII number 13, and came from the movement of a typwriter to the left of a sheet of paper. 
  5. «Different endo of line characteres in text files». IBM Knowledge Center. Consultado em 17 de março de 2021. In general, z/OS UNIX text files contain a newline character at the end of each line. In ASCII, newline is X'0A'. In EBCDIC, newline is X'15'. 
  6. «Convert between Unix and Windows text files». Indiana University Knowledge Base. Consultado em 17 de março de 2021. The format of Windows and Unix text files differs slightly. In Windows, lines end with both the line feed and carriage return ASCII characters, but Unix uses only a line feed. As a consequence, some Windows applications will not show the line breaks in Unix-format files. 
  7. «Escape sequences». Geeks for Geeks. Consultado em 17 de março de 2021. Here we are using \r, which is carriage return character. 
  8. «CR». Computer Hope. Consultado em 17 de março de 2021. In programming languages such as C, Java, and Perl and regular expressions the return or CR character is represented as a \r escape sequence. 
  9. «How to remove CTRL-M (^M) characters from a file in Linux». Suse. Consultado em 17 de março de 2021. How to remove CTRL-M (^M) blue carriage return characters from a file in Linux. 
Ícone de esboço Este artigo sobre informática é um esboço. Você pode ajudar a Wikipédia expandindo-o.