Friday 30 March 2018

Opções binárias tlc


Opções binárias Tlc
Fconfigure channelId name value? valor do nome. ?
O ChannelId identifica o canal para o qual definir ou consultar uma opção e deve se referir a um canal aberto, como um canal padrão Tcl (stdin, stdout ou stderr), o valor de retorno de uma invocação de aberto ou soquete ou o resultado de um comando de criação de canal fornecido por uma extensão Tcl.
Se nenhum argumento de nome ou valor for fornecido, o comando retornará uma lista contendo nomes de opções alternadas e valores para o canal. Se o nome for fornecido, mas nenhum valor, o comando retornará o valor atual da opção dada. Se um ou mais pares de nome e valor forem fornecidos, o comando define cada uma das opções nomeadas para o valor correspondente; neste caso, o valor de retorno é uma string vazia.
As opções descritas abaixo são suportadas para todos os canais. Além disso, cada tipo de canal pode adicionar opções que apenas ele suporta. Consulte a entrada manual para o comando que cria cada tipo de canais para as opções que esse tipo específico de canal suporta. Por exemplo, veja a entrada manual para o comando socket para suas opções adicionais.
-blocking boolean A opção - blocking determina se as operações de E / S no canal podem fazer com que o processo seja bloqueado indefinidamente. O valor da opção deve ser um valor booleano adequado. Os canais normalmente estão no modo de bloqueio; Se um canal for colocado no modo de não bloqueio, ele afetará a operação dos comandos get, read, puts, flush e close; veja a documentação desses comandos para obter detalhes. Para que o modo não bloqueado funcione corretamente, o aplicativo deve estar usando o loop do evento Tcl (por exemplo, chamando Tcl_DoOneEvent ou invocando o comando vwait).
-buffering newValue Se newValue estiver cheio, o sistema de E / S será a saída de buffer até o buffer interno estar cheio ou até o comando flush for invocado. Se newValue for linha, o sistema de E / S liberará automaticamente a saída para o canal sempre que um caractere da nova linha for emitido. Se o newValue for nenhum, o sistema de E / S será descarregado automaticamente após cada operação de saída. O padrão é para que o limite seja configurado para completo, exceto para os canais que se conectam a dispositivos semelhantes a terminais; Para esses canais, a configuração inicial é linha. Além disso, stdin e stdout são inicialmente definidos para linha, e stderr está configurado para nenhum.
-buffersize newSize Newvalue deve ser um número inteiro; seu valor é usado para definir o tamanho dos buffers, em bytes, posteriormente alocado para este canal para armazenar entrada ou saída. Newvalue deve ser entre dez e um milhão, permitindo tampões de dez a um milhão de bytes de tamanho.
-encoding name Esta opção é usada para especificar a codificação do canal, para que os dados possam ser convertidos para Unicode e para uso em Tcl. Por exemplo, para que Tcl leia caracteres de um arquivo japonês em shiftjis e processe corretamente e exiba o conteúdo, a codificação seria configurada para shiftjis. Posteriormente, ao ler o canal, os bytes no arquivo japonês seriam convertidos para Unicode à medida que forem lidos. A escrita também é suportada - à medida que as seqüências de caracteres Tcl são gravadas no canal, elas serão automaticamente convertidas para a codificação especificada na saída.
Se um arquivo contém dados binários puros (por exemplo, uma imagem JPEG), a codificação para o canal deve ser configurada para ser binária. Tcl então não atribuirá nenhuma interpretação aos dados no arquivo e simplesmente lê ou escreva bytes crus. O comando binário Tcl pode ser usado para manipular esses dados orientados a bytes.
A codificação padrão para canais recém-abertos é a mesma codificação de sistema dependente de plataforma e local usada para interface com o sistema operacional.
-eofchar inChar outChar> Esta opção oferece suporte a sistemas de arquivos do DOS que usam Control-z (& # 92; x1a) como marcador de fim de arquivo. Se char não é uma string vazia, esse caractere indica o fim do arquivo quando ele é encontrado durante a entrada. Para saída, o caractere de fim de arquivo é emitido quando o canal está fechado. Se char for a string vazia, então não há um marcador especial de caracteres de fim de arquivo. Para canais de leitura-escrita, uma lista de dois elementos especifica o final do marcador de arquivo para entrada e saída, respectivamente. Como uma conveniência, ao definir o caractere de fim de arquivo para um canal de leitura e gravação, você pode especificar um único valor que se aplicará à leitura e à escrita. Ao consultar o caractere de fim de arquivo de um canal de leitura e gravação, uma lista de dois elementos sempre será retornada. O valor padrão para - eofchar é a cadeia vazia em todos os casos, exceto para arquivos no Windows. Nesse caso, o - eofchar é Control-z (& # 92; x1a) para leitura e a string vazia para escrita.
-translation inMode outMode> Nos scripts Tcl, o fim de uma linha sempre é representado usando um único caractere de linha nova (& # 92; n). No entanto, em arquivos e dispositivos reais, o final de uma linha pode ser representado de forma diferente em diferentes plataformas, ou mesmo para dispositivos diferentes na mesma plataforma. Por exemplo, sob UNIX, as novas linhas são usadas em arquivos, enquanto que as seqüências de retorno de linha de retorno são usadas normalmente em conexões de rede. Na entrada (ou seja, com get e read), o sistema Tcl I / O traduz automaticamente a representação externa de fim de linha em caracteres de nova linha. Após a saída (ou seja, com puts), o sistema de E / S traduz linhas novas para a representação externa da extremidade da linha. O modo de tradução padrão, auto, lida com todos os casos comuns, mas a opção - translation fornece controle explícito sobre as traduções de fim de linha.
O valor associado a - translation é um único item para canais somente leitura e somente para gravação. O valor é uma lista de dois elementos para canais de leitura e gravação; o modo de tradução lida é o primeiro elemento da lista e o modo de tradução de gravação é o segundo elemento. Como conveniência, ao configurar o modo de tradução para um canal de leitura e gravação, você pode especificar um valor único que se aplicará à leitura e à escrita. Ao consultar o modo de tradução de um canal de leitura e gravação, uma lista de dois elementos sempre será retornada. Atualmente, os seguintes valores são suportados:
auto Como o modo de tradução de entrada, trata automaticamente qualquer linha nova (lf), retorno de carro (cr) ou retorno de carro seguido de uma nova linha (crlf) como a representação de fim de linha. A representação de fim de linha pode até mudar de linha para linha, e todos os casos são traduzidos para uma nova linha. Como o modo de tradução de saída, o auto escolhe uma representação específica da plataforma; para soquetes em todas as plataformas Tcl escolhe o crlf, para todos os sabores do Unix, ele escolhe o lf, para a plataforma Macintosh ele escolhe cr e para os vários sabores do Windows ele escolhe o crlf. A configuração padrão para - translation é automática para entrada e saída.
binário Não são realizadas traduções de fim de linha. Isso é quase idêntico ao modo lf, exceto que, além disso, o modo binário também define o caractere de fim de arquivo para a seqüência vazia (o que o desativa) e define a codificação como binária (o que desativa a filtragem de codificação). Veja a descrição de - eofchar e - encoding para obter mais informações.
Internamente, ou seja, quando se trata do comportamento real do tradutor, esse valor é idêntico ao lf e, portanto, é relatado como tal quando consultado. Mesmo que o binário fosse usado para configurar a tradução.
cr O fim de uma linha no arquivo ou dispositivo subjacente é representado por um único caractere de retorno de carro. Como o modo de tradução de entrada, o modo CR converte o retorno do carro para os caracteres da nova linha. Como o modo de tradução de saída, o modo cr traduz os caracteres da nova linha para os retornos de carro. Esse modo geralmente é usado em plataformas Macintosh.
crlf O fim de uma linha no arquivo ou dispositivo subjacente é representado por um caractere de retorno de carro seguido de um caractere de saída de linha. Como o modo de tradução de entrada, o modo crlf converte as seqüências de transporte-retorno-alimentação de linha para caracteres de nova linha. Como o modo de tradução de saída, o modo crlf traduz caracteres de linha nova para sequências de retorno de linha de retorno de carro. Esse modo normalmente é usado em plataformas Windows e para conexões de rede.
Se o fim de uma linha no arquivo ou dispositivo subjacente for representado por um único caractere de linha nova (linefeed). Neste modo, nenhuma tradução ocorre durante a entrada ou a saída. Esse modo normalmente é usado em plataformas UNIX.
Abra um soquete e leia linhas dele sem nunca bloquear o processamento de outros eventos:

Sanitär - und Heizungstechnik GmbH.
Michael Entenmann.
Fehler 404 - Seite nicht gefunden.
Es sieht so aus, als ob wir nicht gefunden haben wonach du suchst.
Mögliche Gründe dafür:
Vocês morreram na Internet, por exemplo, falsch eingetippt Die Seite nach der du suchst wörde möglicherweise verschoben, aktualisiert oder gelöscht.
Versuche bitte folgendes:
Überprüfe morre URL no botão Fehler Drücke den Aktualisieren-Button (F5) no navegador deinem. Gehe zurück zu Startseite.
Michael Entenmann Sanitär und Heizungstechnik GmbH.

Opções binárias Tlc
stringString de string de varredura binária? varName varName. ?
O formatString consiste em uma seqüência de zero ou mais especificadores de campo separados por zero ou mais espaços. Cada especificador de campo é um caractere de um único caractere seguido por uma contagem numérica opcional. A maioria dos especificadores de campo consome um argumento para obter o valor a ser formatado. O caractere de tipo especifica como o valor deve ser formatado. A contagem normalmente indica quantos itens do tipo especificado são retirados do valor. Se presente, a contagem é um inteiro decimal não negativo ou *, o que normalmente indica que todos os itens do valor devem ser usados. Se o número de argumentos não corresponder ao número de campos na cadeia de formato que consome argumentos, um erro é gerado.
Aqui está um pequeno exemplo para esclarecer a relação entre os especificadores de campo e os argumentos:
O primeiro argumento é uma lista de quatro números, mas devido à contagem de 3 para o especificador de campo associado, somente os três primeiros serão usados. O segundo argumento está associado ao segundo especificador de campo. A cadeia binária resultante contém os quatro números 1.0, 2.0, 3.0 e 0.1.
Cada par de conteúdos de tipo move um cursor imaginário através dos dados binários, armazenando bytes na posição atual e avançando o cursor logo após o último byte armazenado. O cursor está inicialmente na posição 0 no início dos dados. O tipo pode ser um dos seguintes caracteres:
a Armazena uma cadeia de caracteres de comprimento na string de saída. Cada caractere é tomado como modulo 256 (ou seja, o byte baixo de cada caractere é usado e o byte alto descartado), então ao armazenar cordas de caracteres não totalmente expressáveis ​​usando os caracteres & # 92; u0000 - & # 92; u00ff, o codificador convertto O comando deve ser usado primeiro se este truncamento não for desejado (ou seja, se os caracteres não fazem parte do conjunto de caracteres ISO 8859-1). Se arg tiver menos que os bytes de contagem, os bytes de zero adicionais são usados ​​para remover o campo. Se arg for mais longo que o comprimento especificado, os caracteres extras serão ignorados. Se count for *, então todos os bytes em arg serão formatados. Se a contagem for omitida, um caractere será formatado. Por exemplo, retornará uma seqüência de caracteres equivalente a alfa & # 92; 000 & # 92; 000bravoc.
A Este formulário é o mesmo que a, exceto que os espaços são usados ​​para preenchimento em vez de nulos. Por exemplo, retornará a bravura alfa.
b Armazena uma série de dígitos binários de contagem em ordem inferior a alta dentro de cada byte na string de saída. Arg deve conter uma seqüência de 1 e 0 caracteres. Os bytes resultantes são emitidos na primeira a última ordem com os bits sendo formatados em ordem inferior a alta dentro de cada byte. Se arg tiver menos que dígitos de contagem, os zeros serão usados ​​para os bits restantes. Se arg tiver mais do que o número especificado de dígitos, os dígitos extras serão ignorados. Se count for *, todos os dígitos em arg serão formatados. Se a contagem for omitida, um formato será formatado. Se o número de bits formatados não terminar em um limite de bytes, os bits restantes do último byte serão zero. Por exemplo, retornará uma string equivalente a & # 92; x07 & # 92; x87 & # 92; x05.
B Este formulário é o mesmo que b, exceto que os bits são armazenados em ordem alta a baixa dentro de cada byte. Por exemplo, irá retornar uma seqüência de caracteres equivalente a & # 92; xe0 & # 92; xe1 & # 92; xa0.
h Armazena uma seqüência de dígitos de dígitos hexadecimais em baixo a alto dentro de cada byte na seqüência de saída. Arg deve conter uma seqüência de caracteres no set `` 0123456789abcdefABCDEF ''. Os bytes resultantes são emitidos na primeira a última ordem, com os dígitos hexadecimais formatados em ordem inferior a alta dentro de cada byte. Se arg tiver menos que dígitos de contagem, os zeros serão usados ​​para os dígitos restantes. Se arg tiver mais do que o número especificado de dígitos, os dígitos extras serão ignorados. Se count for *, todos os dígitos em arg serão formatados. Se a contagem for omitida, um formato será formatado. Se o número de dígitos formatados não termina em um limite de bytes, os bits restantes do último byte serão zero. Por exemplo, retornará uma string equivalente a & # 92; xba & # 92; x00 & # 92; xed & # 92; x0f.
H Este formulário é o mesmo que h, exceto que os dígitos são armazenados em ordem alta a baixa dentro de cada byte. Por exemplo, irá retornar uma seqüência de caracteres equivalente a x2 xab & # 92; x00 & # 92; xde & # 92; xf0.
c Armazena um ou mais valores inteiros de 8 bits na cadeia de saída. Se nenhuma contagem for especificada, então arg deve consistir em um valor inteiro; Caso contrário, arg deve consistir em uma lista contendo pelo menos contar elementos inteiros. Os 8 bits de ordem inferior de cada número inteiro são armazenados como um valor de um byte na posição do cursor. Se count for *, então todos os inteiros na lista são formatados. Se o número de elementos na lista for menor que a contagem, um erro será gerado. Se o número de elementos na lista for maior que a contagem, os elementos extras serão ignorados. Por exemplo, retornará uma seqüência de caracteres equivalente ao & # 92; x03 & # 92; xfd & # 92; x80 & # 92; x04 & # 92; x02 & # 92; x05, enquanto que irá gerar um erro.
s Este formulário é o mesmo que c, exceto que ele armazena um ou mais inteiros de 16 bits na ordem de byte little-endian na seqüência de saída. Os 16 bits de ordem inferior de cada número inteiro são armazenados como um valor de dois bytes na posição do cursor com o byte menos significativo armazenado primeiro. Por exemplo, retornará uma string equivalente a & # 92; x03 & # 92; x00 & # 92; xfd & # 92; xff & # 92; x02 & # 92; x01.
S Este formulário é o mesmo que s, exceto que ele armazena um ou mais inteiros de 16 bits na ordem de byte big-endian na seqüência de saída. Por exemplo, retornará uma seqüência de caracteres equivalente a & # 92; x00 & # 92; x03 & # 92; xff & # 92; xfd & # 92; x01 & # 92; x02.
i Este formulário é o mesmo que c, exceto que ele armazena um ou mais inteiros de 32 bits na ordem de byte little-endian na seqüência de saída. Os 32 bits de ordem inferior de cada número inteiro são armazenados como um valor de quatro bytes na posição do cursor com o byte menos significativo armazenado primeiro. Por exemplo, retornará uma seqüência de caracteres equivalente a & # 92; x03 & # 92; x00 & # 92; x00 & # 92; x00 & # 92; xfd & # 92; xff & # 92; xff & # 92; xff & # 92; x00 & # 92; x00 & # 92; x01 & # 92; x00.
I Este formulário é o mesmo que eu, exceto que ele armazena um ou mais um ou mais inteiros de 32 bits na ordem de byte big-endian na seqüência de saída. Por exemplo, retornará uma seqüência de caracteres equivalente a & # 92; x00 & # 92; x00 & # 92; x00 & # 92; x03 & # 92; xff & # 92; xff & # 92; xff & # 92; xfd & # 92; x00 & # 92; x01 & # 92; x00 & # 92; x00.
w Este formulário é o mesmo que c, exceto que ele armazena um ou mais inteiros de 64 bits na ordem de byte little-endian na seqüência de saída. Os bits de 64 bits de baixo número de cada número inteiro são armazenados como um valor de oito bytes na posição do cursor com o byte menos significativo armazenado primeiro. Por exemplo, retornará a linha HelloTcl.
W Este formulário é o mesmo que w, exceto que ele armazena um ou mais um ou mais inteiros de 64 bits na ordem de byte big-endian na string de saída. Por exemplo, retornará a string BigEndian.
f Este formulário é o mesmo que c, exceto que ele armazena uma ou mais uma ou mais precisão única flutuando na representação nativa da máquina na seqüência de saída. Esta representação não é portátil em arquiteturas, portanto, não deve ser usado para comunicar números de ponto flutuante na rede. O tamanho de um número de ponto flutuante pode variar de acordo com as arquiteturas, portanto, o número de bytes gerados pode variar. Se o valor transborda a representação nativa da máquina, então, o valor de FLT_MAX conforme definido pelo sistema será usado. Como o Tcl usa números de ponto flutuante de precisão dupla internamente, pode haver alguma perda de precisão na conversão para uma única precisão. Por exemplo, em um sistema Windows que esteja sendo executado em um processador Intel Pentium, retornará uma seqüência de caracteres equivalente a & # 92; xcd & # 92; xcc & # 92; xcc & # 92; x3f & # 92; x9a & # 92; x99 & # 92; x59 & # 92; x40.
d Este formulário é igual a f, exceto que ele armazena uma ou mais uma ou mais flutuações de dupla precisão na representação nativa da máquina na seqüência de saída. Por exemplo, em um sistema Windows executado em um processador Intel Pentium, retornará uma seqüência de caracteres equivalente a x9 & x9a & # 92; x99 & # 92; x99 & # 92; x99 & # 92; x99 & # 92; x99 & # 92; xf9 & # 92; x3f.
x As lojas contêm bytes nulos na seqüência de saída. Se a contagem não for especificada, armazena um byte nulo. Se count for *, gera um erro. Esse tipo não consome um argumento. Por exemplo, retornará uma string equivalente a abc & # 92; 000def & # 92; 000 & # 92; 000ghi.
X Move os contos de contagem do cursor na string de saída. Se a contagem for * ou for maior que a posição atual do cursor, o cursor está posicionado no local 0 para que o próximo byte armazenado seja o primeiro byte na seqüência de resultados. Se a contagem for omitida, o cursor será movido de volta para um byte. Esse tipo não consome um argumento. Por exemplo, retornará dghi.
@ Move o cursor para a localização absoluta na string de saída especificada pela contagem. Posição 0 refere-se ao primeiro byte na seqüência de saída. Se a contagem se refere a uma posição além do último byte armazenado até agora, os bytes nulos serão colocados nos locais não inicializados e o cursor será colocado no local especificado. Se count for *, então o cursor é movido para o fim atual da string de saída. Se a contagem for omitida, um erro será gerado. Esse tipo não consome um argumento. Por exemplo, retornará abfdeghi & # 92; 000 & # 92; 000j.
Como no formato binário, o formatString consiste em uma seqüência de zero ou mais especificadores de campo separados por zero ou mais espaços. Cada especificador de campo é um caractere de um único caractere seguido por uma contagem numérica opcional. A maioria dos especificadores de campo consome um argumento para obter a variável na qual os valores digitalizados devem ser colocados. O caractere de tipo especifica como os dados binários devem ser interpretados. A contagem normalmente indica quantos itens do tipo especificado são retirados dos dados. Se presente, a contagem é um inteiro decimal não negativo ou *, o que normalmente indica que todos os itens restantes nos dados devem ser usados. Se não houver suficientes bytes restantes após a posição atual do cursor para satisfazer o especificador de campo atual, a variável correspondente é deixada intacta e a varredura binária retorna imediatamente com o número de variáveis ​​que foram definidas. Se não houver argumentos suficientes para todos os campos na cadeia de formatos que consomem argumentos, um erro é gerado.
Um exemplo semelhante ao do formato binário deve explicar a relação entre especificadores de campo e argumentos no caso do subcomando de varredura binária:
Este comando (desde que a string binária nos bytes da variável seja suficientemente longa) atribua uma lista de três inteiros à variável primeiro e atribui um único valor à variável segundo. Se os bytes contiverem menos de 8 bytes (ou seja, quatro inteiros de 2 bytes), nenhuma atribuição para o segundo será feita e se os bytes contiverem menos de 6 bytes (ou seja, três inteiros de 2 bytes), nenhuma atribuição para o primeiro será feita. Por isso: será impresso (assumindo que nenhuma variável é definida anteriormente):
É importante notar que os sistemas c, s e S (e i e I em sistemas de 64 bits) serão digitalizados em valores de tamanho de dados longos. Ao fazer isso, os valores que têm seu conjunto de bits altos (0x80 para caracteres, 0x8000 para shorts, 0x80000000 para ints) serão sinal estendido. Assim, o seguinte ocorrerá: se você quiser produzir um valor não assinado, você pode mascarar o valor de retorno para o tamanho desejado. Por exemplo, para produzir um valor curto não assinado:
Cada par de conteúdos de tipo move um cursor imaginário através dos dados binários, lendo bytes da posição atual. O cursor está inicialmente na posição 0 no início dos dados. O tipo pode ser um dos seguintes caracteres:
a Os dados são uma sequência de caracteres de contagem de comprimento. Se a contagem for *, todos os bytes restantes na string serão digitalizados na variável. Se a contagem for omitida, um caractere será escaneado. Todos os caracteres digitalizados serão interpretados como sendo na faixa & # 92; u0000 - & # 92; u00ff para que o comando convertfrom de codificação possa ser necessário se a string não for uma string ISO 8859-1. Por exemplo, retornará 1 com a seqüência de caracteres equivalente a abcde & # 92; 000 armazenada em var1 e var2 esquerda não modificada.
A Este formulário é o mesmo que a, exceto os espaços em branco e os nulos são despojados do valor digitalizado antes de serem armazenados na variável. Por exemplo, retornará 1 com abc efghi armazenado em var1.
b Os dados são transformados em uma série de dígitos binários de contagem em ordem inferior a alta, representada como uma seqüência de caracteres `` 1 '' e `` 0 ''. Os bytes de dados são digitalizados na primeira a última ordem, com os bits sendo feitos em ordem inferior a alta dentro de cada byte. Quaisquer bits extras no último byte são ignorados. Se a contagem for *, então todos os bits restantes na string serão digitalizados. Se a contagem for omitida, um bit será escaneado. Por exemplo, retornará 2 com 11100 armazenados em var1 e 1110000110100000 armazenados em var2.
B Este formulário é o mesmo que b, exceto que os bits são feitos em ordem alta a baixa dentro de cada byte. Por exemplo, retornará 2 com 01110 armazenados em var1 e 1000011100000101 armazenados em var2.
h Os dados são transformados em uma série de dígitos hexadecimais em ordem inferior a alta, representada como uma seqüência de caracteres no conjunto `` 0123456789abcdef ''. Os bytes de dados são digitalizados na primeira a última ordem com os dígitos hexadecimais sendo feitos em ordem inferior a alta dentro de cada byte. Quaisquer bits extras no último byte são ignorados. Se a contagem for *, então todos os dígitos hexadecimais restantes na seqüência serão escaneados. Se a contagem for omitida, um dígito hexadecimal será escaneado. Por exemplo, retornará 2 com 706 armazenados em var1 e 50 armazenados em var2.
H Este formulário é o mesmo que h, exceto que os dígitos são tomados em ordem alta a baixa dentro de cada byte. Por exemplo, retornará 2 com 078 armazenados em var1 e 05 armazenados em var2.
c Os dados são convertidos em números inteiros assinados de 8 bits e armazenados na variável correspondente como uma lista. Se a contagem for *, então todos os bytes restantes na string serão varridos. Se a contagem for omitida, um inteiro de 8 bits será escaneado. Por exemplo, retornará 2 com 7 -122 armazenados em var1 e 5 armazenados em var2. Observe que os números inteiros retornados são assinados, mas eles podem ser convertidos em quantidades não assinadas de 8 bits usando uma expressão como:
s Os dados são interpretados como números inteiros assinados de 16 bits representados na ordem de byte little-endian. Os inteiros são armazenados na variável correspondente como uma lista. Se a contagem for *, então todos os bytes restantes na string serão varridos. Se a contagem for omitida, um inteiro de 16 bits será escaneado. Por exemplo, retornará 2 com 5 7 armazenados em var1 e -16 armazenados em var2. Observe que os inteiros retornados são assinados, mas eles podem ser convertidos em quantidades não assinadas de 16 bits usando uma expressão como:
S Este formulário é o mesmo que s, exceto que os dados são interpretados como números inteiros assinados de 16 bits representados na ordem de byte grande-endian. Por exemplo, retornará 2 com 5 7 armazenados em var1 e -16 armazenados em var2.
i Os dados são interpretados como números inteiros assinados de 32 bits representados na ordem de bytes little-endian. Os inteiros são armazenados na variável correspondente como uma lista. Se a contagem for *, então todos os bytes restantes na string serão varridos. Se a contagem for omitida, um inteiro de 32 bits será escaneado. Por exemplo, retornará 2 com 5 7 armazenados em var1 e -16 armazenados em var2. Observe que os inteiros retornados são assinados, mas podem ser convertidos em quantidades de 32 bits não assinadas usando uma expressão como:
I Este formulário é o mesmo que eu, exceto que os dados são interpretados como números inteiros assinados de 32 bits representados na ordem dos bytes de enriquecimento. Por exemplo, retornará 2 com 5 7 armazenados em var1 e -16 armazenados em var2.
w Os dados são interpretados como conter números inteiros assinados de 64 bits representados na ordem de byte little-endian. Os inteiros são armazenados na variável correspondente como uma lista. Se a contagem for *, então todos os bytes restantes na string serão varridos. Se a contagem for omitida, um inteiro de 64 bits será escaneado. Por exemplo, retornará 2 com 30064771077 armazenados em var1 e -16 armazenados em var2. Observe que os inteiros retornados são assinados e não podem ser representados pelo Tcl como valores não assinados.
W Este formulário é o mesmo que w, exceto que os dados são interpretados como conter números inteiros assinados de 64 bits representados na ordem de byte big-endian. Por exemplo, retornará 2 com 21474836487 armazenados em var1 e -16 armazenados em var2.
f Os dados são interpretados como contagem de números de ponto flutuante de precisão única na representação nativa da máquina. Os números de ponto flutuante são armazenados na variável correspondente como uma lista. Se a contagem for *, então todos os bytes restantes na string serão varridos. Se a contagem for omitida, um número de ponto flutuante de precisão única será escaneado. O tamanho de um número de ponto flutuante pode variar de acordo com as arquiteturas, portanto, o número de bytes que são digitalizados pode variar. Se os dados não representarem um número de ponto flutuante válido, o valor resultante é indefinido e dependente do compilador. Por exemplo, em um sistema Windows executado em um processador Intel Pentium, retornará 1 com 1.6000000238418579 armazenado em var1.
d Este formulário é igual a f, exceto que os dados são interpretados como contagem de números de ponto flutuante de dupla precisão na representação nativa da máquina. Por exemplo, em um sistema Windows executado em um processador Intel Pentium, retornará 1 com 1.6000000000000001 armazenado em var1.
x Move o cursor para a contagem contábil bytes na string. Se a contagem for * ou for maior do que o número de bytes após a posição atual do cursor do cursor, o cursor é posicionado após o último byte na string. Se a contagem for omitida, então o cursor é movido para a frente um byte. Observe que esse tipo não consome um argumento. Por exemplo, retornará 1 com 0304 armazenado em var1.
X Move os contos de contagem do cursor na string. Se a contagem for * ou for maior do que a posição atual do cursor, o cursor será posicionado no local 0, de modo que o próximo byte digitalizado seja o primeiro byte na string. Se a contagem for omitida, o cursor será movido de volta para um byte. Observe que esse tipo não consome um argumento. Por exemplo, retornará 2 com 1 2 armazenados em var1 e 020304 armazenados em var2.
@ Move o cursor para a localização absoluta na cadeia de dados especificada pela contagem. Observe que a posição 0 refere-se ao primeiro byte na string. Se a contagem se refere a uma posição além do fim da string, o cursor é posicionado após o último byte. Se a contagem for omitida, um erro será gerado. Por exemplo, retornará 2 com 1 2 armazenados em var1 e 020304 armazenados em var2.
Este procedimento lê uma string de um canal que foi escrito pelo procedimento writeString anteriormente apresentado:

Programação Tcl / Trabalhando com arquivos.
Além das funcionalidades conhecidas do stdio de C, o Tcl oferece mais comandos que lidam com arquivos, como o que os shells fornecem, embora com freqüência um pouco mais detalhado. aqui estão alguns exemplos:
Liste todos os arquivos no diretório atual que correspondem ao padrão *.tcl.
Para permitir que o código seja executado temporariamente em outro diretório, use esse padrão:
Mais precisamente, muitas operações de "arquivo" funcionam em geral em "canais", que podem ser.
canais padrão (stdin, stdout, stderr) arquivos abertos com aberto. Tubos abertos com 'aberto | soquetes (TCP)
Os arquivos são frequentemente abordados com nomes de caminho, que indicam sua posição na árvore de diretórios. Como o Unix, o Tcl usa "/" como separador de caminho, enquanto no Windows "\" é o modo nativo - o que traz problemas não apenas para Tcl, mas até para C, porque "\" é o caractere de escape em ambos, e que, por exemplo, \ t é analisado como guia horizontal, \ n como nova linha, etc. Felizmente, o Windows também aceita nativo "/", então você pode usar a barra direta em ambos os programas Tcl e C como separador de caminho sem preocupações. No entanto, você ainda precisa cuidar de seqüências de escape. Uma medida stopgap é.
para escapar do caractere de escape, ou seja, escreva \\ para \, ou nomes de backslashed de suporte, e.
Mas o Tcl permite usar o separador "normal" / em quase todas as situações, então você está mais seguro com isso. Infelizmente, as coisas estão tristes para os usuários de Mac, já que o MacOS (antes de X) aceita apenas ":" como separador de arquivos.
Se você precisar, aqui está a maneira de converter entre as duas formas:
Você pode até usar o comando join join: file join arg1 arg2. argN.
A Tcl cuidará de todos os detalhes dependentes da plataforma para criar um caminho independente da plataforma. Por exemplo:
set some [file join foo bar grill. txt]
resultará no seguinte caminho (na máquina do Windows): foo / bar / grill. txt.
Os comandos de entrada / saída do Tcl são muito próximos dos que são do stdio de C (basta retirar o f) principal:
A funcionalidade printf da C é dividida em duas etapas:
formatar os dados em uma seqüência de caracteres com formato (que é muito parecido com o sprintf) emitir a seqüência resultante com puts. Por exemplo,
Para processar um arquivo de texto por linha, você tem duas opções. Se o arquivo for menor do que vários megabytes, você pode lê-lo de uma só vez:
Para arquivos de tamanho grande, você pode ler as linhas uma a uma (embora este seja um pouco mais lento do que a abordagem acima):
Finalmente, se você pode formatar seu arquivo para que seja um código Tcl executável, o método de leitura a seguir é o mais rápido:
Para "tocar um arquivo", ou seja, crie-o se não existir e, em qualquer caso, atualize seu tempo de modificação, você pode usar isso:
Todos os arquivos são feitos de bytes, que são feitos de bits, que são binários. O termo "binário" com arquivos relaciona-se principalmente ao fato de que eles podem conter bytes de qualquer valor, e as extremidades de linha (Carriage Return + Newline no mundo DOS / Windows) não devem ser traduzidas. Tcl pode lidar com arquivos "binários" sem problemas - basta configurar o canal como binário após a abertura:
Agora, o conteúdo variável contém o conteúdo do arquivo, byte para byte.
Para testar se um arquivo é "binário", no sentido de que contém NUL bytes:
Muitas operações úteis com arquivos são coletadas no comando do arquivo. O primeiro argumento diz que operação fazer:

Opções binárias Tlc
formato de codificação binária? valor de impressão. ? dados.
formato binário formatoString? arg arg. ?
stringString de string de varredura binária? varName varName. ?
Observe que outras operações em dados binários, como tomar uma subseqüência, obter seu comprimento ou reinterpretá-lo como uma seqüência de caracteres em algumas codificações, são realizadas por outros comandos Tcl (intervalo de seqüência, comprimento da cadeia e codificação convertfrom nos exemplos de casos ). Uma string binária em Tcl é meramente uma onde todos os caracteres que contém estão no intervalo &0000000000 - & # 92; u00FF.
base64 A codificação binária base64 é comumente usada em mensagens de correio e documentos XML, e usa principalmente maiúsculas e minúsculas e dígitos. Tem a distinção de poder ser reorganizado arbitrariamente sem perder informações.
Durante a codificação, as seguintes opções são suportadas:
-maxlen length Indica que a saída deve ser dividida em linhas que não sejam mais do que caracteres de comprimento. Por padrão, as linhas não são divididas.
-wrapchar character Indica que, quando as linhas são divididas por causa da opção - maxlen, o caractere deve ser usado para separar linhas. Por padrão, este é um caractere de linha nova, & # 8220; & # 92; n & # 8221 ;.
During decoding, the following options are supported:
-strict Instructs the decoder to throw an error if it encounters whitespace characters. Otherwise it ignores them.
hex The hex binary encoding converts each byte to a pair of hexadecimal digits in big-endian form.
No options are supported during encoding. During decoding, the following options are supported:
-strict Instructs the decoder to throw an error if it encounters whitespace characters. Otherwise it ignores them.
uuencode The uuencode binary encoding used to be common for transfer of data between Unix systems and on USENET, but is less common these days, having been largely superseded by the base64 binary encoding.
During encoding, the following options are supported (though changing them may produce files that other implementations of decoders cannot process):
-maxlen length Indicates that the output should be split into lines of no more than length characters. By default, lines are split every 61 characters, and this must be in the range 3 to 85 due to limitations in the encoding.
-wrapchar character Indicates that, when lines are split because of the - maxlen option, character should be used to separate lines. By default, this is a newline character, “\n”.
During decoding, the following options are supported:
-strict Instructs the decoder to throw an error if it encounters unexpected whitespace characters. Otherwise it ignores them.
Note that neither the encoder nor the decoder handle the header and footer of the uuencode format.
The formatString consists of a sequence of zero or more field specifiers separated by zero or more spaces. Each field specifier is a single type character followed by an optional flag character followed by an optional numeric count . Most field specifiers consume one argument to obtain the value to be formatted. The type character specifies how the value is to be formatted. The count typically indicates how many items of the specified type are taken from the value. If present, the count is a non-negative decimal integer or * , which normally indicates that all of the items in the value are to be used. If the number of arguments does not match the number of fields in the format string that consume arguments, then an error is generated. The flag character is ignored for binary format .
Here is a small example to clarify the relation between the field specifiers and the arguments:
The first argument is a list of four numbers, but because of the count of 3 for the associated field specifier, only the first three will be used. The second argument is associated with the second field specifier. The resulting binary string contains the four numbers 1.0, 2.0, 3.0 and 0.1.
Each type-count pair moves an imaginary cursor through the binary data, storing bytes at the current position and advancing the cursor to just after the last byte stored. The cursor is initially at position 0 at the beginning of the data. The type may be any one of the following characters:
a Stores a byte string of length count in the output string. Every character is taken as modulo 256 (i. e. the low byte of every character is used, and the high byte discarded) so when storing character strings not wholly expressible using the characters \u0000-\u00ff, the encoding convertto command should be used first to change the string into an external representation if this truncation is not desired (i. e. if the characters are not part of the ISO 8859-1 character set.) If arg has fewer than count bytes, then additional zero bytes are used to pad out the field. If arg is longer than the specified length, the extra characters will be ignored. If count is * , then all of the bytes in arg will be formatted. If count is omitted, then one character will be formatted. For example, will return a string equivalent to alpha\000\000bravoc , will return a string equivalent to \342\202\254 (which is the UTF-8 byte sequence for a Euro-currency character) and will return a string equivalent to \244 (which is the ISO 8859-15 byte sequence for a Euro-currency character). Contrast these last two with: which returns a string equivalent to \254 (i. e. \xac ) by truncating the high-bits of the character, and which is probably not what is desired.
A This form is the same as a except that spaces are used for padding instead of nulls. For example, will return alpha bravoc .
b Stores a string of count binary digits in low-to-high order within each byte in the output string. Arg must contain a sequence of 1 and 0 characters. The resulting bytes are emitted in first to last order with the bits being formatted in low-to-high order within each byte. If arg has fewer than count digits, then zeros will be used for the remaining bits. If arg has more than the specified number of digits, the extra digits will be ignored. If count is * , then all of the digits in arg will be formatted. If count is omitted, then one digit will be formatted. If the number of bits formatted does not end at a byte boundary, the remaining bits of the last byte will be zeros. For example, will return a string equivalent to \x07\x87\x05 .
B This form is the same as b except that the bits are stored in high-to-low order within each byte. For example, will return a string equivalent to \xe0\xe1\xa0 .
H Stores a string of count hexadecimal digits in high-to-low within each byte in the output string. Arg must contain a sequence of characters in the set “0123456789abcdefABCDEF”. The resulting bytes are emitted in first to last order with the hex digits being formatted in high-to-low order within each byte. If arg has fewer than count digits, then zeros will be used for the remaining digits. If arg has more than the specified number of digits, the extra digits will be ignored. If count is * , then all of the digits in arg will be formatted. If count is omitted, then one digit will be formatted. If the number of digits formatted does not end at a byte boundary, the remaining bits of the last byte will be zeros. For example, will return a string equivalent to \xab\x00\xde\xf0\x98 .
h This form is the same as H except that the digits are stored in low-to-high order within each byte. This is seldom required. For example, will return a string equivalent to \xba\x00\xed\x0f\x89 .
c Stores one or more 8-bit integer values in the output string. If no count is specified, then arg must consist of an integer value. If count is specified, arg must consist of a list containing at least that many integers. The low-order 8 bits of each integer are stored as a one-byte value at the cursor position. If count is * , then all of the integers in the list are formatted. If the number of elements in the list is greater than count , then the extra elements are ignored. For example, will return a string equivalent to \x03\xfd\x80\x04\x02\x05 , whereas will generate an error.
s This form is the same as c except that it stores one or more 16-bit integers in little-endian byte order in the output string. The low-order 16-bits of each integer are stored as a two-byte value at the cursor position with the least significant byte stored first. For example, will return a string equivalent to \x03\x00\xfd\xff\x02\x01 .
S This form is the same as s except that it stores one or more 16-bit integers in big-endian byte order in the output string. For example, will return a string equivalent to \x00\x03\xff\xfd\x01\x02 .
t This form (mnemonically tiny ) is the same as s and S except that it stores the 16-bit integers in the output string in the native byte order of the machine where the Tcl script is running. To determine what the native byte order of the machine is, refer to the byteOrder element of the tcl_platform array.
i This form is the same as c except that it stores one or more 32-bit integers in little-endian byte order in the output string. The low-order 32-bits of each integer are stored as a four-byte value at the cursor position with the least significant byte stored first. For example, will return a string equivalent to \x03\x00\x00\x00\xfd\xff\xff\xff\x00\x00\x01\x00.
I This form is the same as i except that it stores one or more one or more 32-bit integers in big-endian byte order in the output string. For example, will return a string equivalent to \x00\x00\x00\x03\xff\xff\xff\xfd\x00\x01\x00\x00.
n This form (mnemonically number or normal ) is the same as i and I except that it stores the 32-bit integers in the output string in the native byte order of the machine where the Tcl script is running. To determine what the native byte order of the machine is, refer to the byteOrder element of the tcl_platform array.
w This form is the same as c except that it stores one or more 64-bit integers in little-endian byte order in the output string. The low-order 64-bits of each integer are stored as an eight-byte value at the cursor position with the least significant byte stored first. For example, will return the string HelloTcl.
W This form is the same as w except that it stores one or more one or more 64-bit integers in big-endian byte order in the output string. For example, will return the string BigEndian.
m This form (mnemonically the mirror of w ) is the same as w and W except that it stores the 64-bit integers in the output string in the native byte order of the machine where the Tcl script is running. To determine what the native byte order of the machine is, refer to the byteOrder element of the tcl_platform array.
f This form is the same as c except that it stores one or more one or more single-precision floating point numbers in the machine's native representation in the output string. This representation is not portable across architectures, so it should not be used to communicate floating point numbers across the network. The size of a floating point number may vary across architectures, so the number of bytes that are generated may vary. If the value overflows the machine's native representation, then the value of FLT_MAX as defined by the system will be used instead. Because Tcl uses double-precision floating point numbers internally, there may be some loss of precision in the conversion to single-precision. For example, on a Windows system running on an Intel Pentium processor, will return a string equivalent to \xcd\xcc\xcc\x3f\x9a\x99\x59\x40 .
r This form (mnemonically real ) is the same as f except that it stores the single-precision floating point numbers in little-endian order. This conversion only produces meaningful output when used on machines which use the IEEE floating point representation (very common, but not universal.)
R This form is the same as r except that it stores the single-precision floating point numbers in big-endian order.
d This form is the same as f except that it stores one or more one or more double-precision floating point numbers in the machine's native representation in the output string. For example, on a Windows system running on an Intel Pentium processor, will return a string equivalent to \x9a\x99\x99\x99\x99\x99\xf9\x3f .
q This form (mnemonically the mirror of d ) is the same as d except that it stores the double-precision floating point numbers in little-endian order. This conversion only produces meaningful output when used on machines which use the IEEE floating point representation (very common, but not universal.)
Q This form is the same as q except that it stores the double-precision floating point numbers in big-endian order.
x Stores count null bytes in the output string. If count is not specified, stores one null byte. If count is * , generates an error. This type does not consume an argument. For example, will return a string equivalent to abc\000def\000\000ghi .
X Moves the cursor back count bytes in the output string. If count is * or is larger than the current cursor position, then the cursor is positioned at location 0 so that the next byte stored will be the first byte in the result string. If count is omitted then the cursor is moved back one byte. This type does not consume an argument. For example, will return dghi .
@ Moves the cursor to the absolute location in the output string specified by count . Position 0 refers to the first byte in the output string. If count refers to a position beyond the last byte stored so far, then null bytes will be placed in the uninitialized locations and the cursor will be placed at the specified location. If count is * , then the cursor is moved to the current end of the output string. If count is omitted, then an error will be generated. This type does not consume an argument. For example, will return abfdeghi\000\000j .
As with binary format , the formatString consists of a sequence of zero or more field specifiers separated by zero or more spaces. Each field specifier is a single type character followed by an optional flag character followed by an optional numeric count . Most field specifiers consume one argument to obtain the variable into which the scanned values should be placed. The type character specifies how the binary data is to be interpreted. The count typically indicates how many items of the specified type are taken from the data. If present, the count is a non-negative decimal integer or * , which normally indicates that all of the remaining items in the data are to be used. If there are not enough bytes left after the current cursor position to satisfy the current field specifier, then the corresponding variable is left untouched and binary scan returns immediately with the number of variables that were set. If there are not enough arguments for all of the fields in the format string that consume arguments, then an error is generated. The flag character “u” may be given to cause some types to be read as unsigned values. The flag is accepted for all field types but is ignored for non-integer fields.
A similar example as with binary format should explain the relation between field specifiers and arguments in case of the binary scan subcommand:
This command (provided the binary string in the variable bytes is long enough) assigns a list of three integers to the variable first and assigns a single value to the variable second . If bytes contains fewer than 8 bytes (i. e. four 2-byte integers), no assignment to second will be made, and if bytes contains fewer than 6 bytes (i. e. three 2-byte integers), no assignment to first will be made. Hence: will print (assuming neither variable is set previously):
It is important to note that the c , s , and S (and i and I on 64bit systems) will be scanned into long data size values. In doing this, values that have their high bit set (0x80 for chars, 0x8000 for shorts, 0x80000000 for ints), will be sign extended. Thus the following will occur: If you require unsigned values you can include the “u” flag character following the field type. For example, to read an unsigned short value:
Each type-count pair moves an imaginary cursor through the binary data, reading bytes from the current position. The cursor is initially at position 0 at the beginning of the data. The type may be any one of the following characters:
a The data is a byte string of length count . If count is * , then all of the remaining bytes in string will be scanned into the variable. If count is omitted, then one byte will be scanned. All bytes scanned will be interpreted as being characters in the range \u0000-\u00ff so the encoding convertfrom command will be needed if the string is not a binary string or a string encoded in ISO 8859-1. For example, will return 1 with the string equivalent to abcde\000 stored in var1 and var2 left unmodified, and will store a Euro-currency character in var2 .
A This form is the same as a , except trailing blanks and nulls are stripped from the scanned value before it is stored in the variable. For example, will return 1 with abc efghi stored in var1 .
b The data is turned into a string of count binary digits in low-to-high order represented as a sequence of “1” and “0” characters. The data bytes are scanned in first to last order with the bits being taken in low-to-high order within each byte. Any extra bits in the last byte are ignored. If count is * , then all of the remaining bits in string will be scanned. If count is omitted, then one bit will be scanned. For example, will return 2 with 11100 stored in var1 and 1110000110100000 stored in var2 .
B This form is the same as b , except the bits are taken in high-to-low order within each byte. For example, will return 2 with 01110 stored in var1 and 1000011100000101 stored in var2 .
H The data is turned into a string of count hexadecimal digits in high-to-low order represented as a sequence of characters in the set “0123456789abcdef”. The data bytes are scanned in first to last order with the hex digits being taken in high-to-low order within each byte. Any extra bits in the last byte are ignored. If count is * , then all of the remaining hex digits in string will be scanned. If count is omitted, then one hex digit will be scanned. For example, will return 2 with 07c stored in var1 and 051f34 stored in var2 .
h This form is the same as H , except the digits are taken in reverse (low-to-high) order within each byte. For example, will return 2 with 706 stored in var1 and 502143 stored in var2 .
Note that most code that wishes to parse the hexadecimal digits from multiple bytes in order should use the H format.
c The data is turned into count 8-bit signed integers and stored in the corresponding variable as a list. If count is * , then all of the remaining bytes in string will be scanned. If count is omitted, then one 8-bit integer will be scanned. For example, will return 2 with 7 -122 stored in var1 and 5 stored in var2 . Note that the integers returned are signed, but they can be converted to unsigned 8-bit quantities using an expression like:
s The data is interpreted as count 16-bit signed integers represented in little-endian byte order. The integers are stored in the corresponding variable as a list. If count is * , then all of the remaining bytes in string will be scanned. If count is omitted, then one 16-bit integer will be scanned. For example, will return 2 with 5 7 stored in var1 and -16 stored in var2 . Note that the integers returned are signed, but they can be converted to unsigned 16-bit quantities using an expression like:
S This form is the same as s except that the data is interpreted as count 16-bit signed integers represented in big-endian byte order. For example, will return 2 with 5 7 stored in var1 and -16 stored in var2 .
t The data is interpreted as count 16-bit signed integers represented in the native byte order of the machine running the Tcl script. It is otherwise identical to s and S . To determine what the native byte order of the machine is, refer to the byteOrder element of the tcl_platform array.
i The data is interpreted as count 32-bit signed integers represented in little-endian byte order. The integers are stored in the corresponding variable as a list. If count is * , then all of the remaining bytes in string will be scanned. If count is omitted, then one 32-bit integer will be scanned. For example, will return 2 with 5 7 stored in var1 and -16 stored in var2 . Note that the integers returned are signed, but they can be converted to unsigned 32-bit quantities using an expression like:
I This form is the same as I except that the data is interpreted as count 32-bit signed integers represented in big-endian byte order. For example, will return 2 with 5 7 stored in var1 and -16 stored in var2 .
n The data is interpreted as count 32-bit signed integers represented in the native byte order of the machine running the Tcl script. It is otherwise identical to i and I . To determine what the native byte order of the machine is, refer to the byteOrder element of the tcl_platform array.
w The data is interpreted as count 64-bit signed integers represented in little-endian byte order. The integers are stored in the corresponding variable as a list. If count is * , then all of the remaining bytes in string will be scanned. If count is omitted, then one 64-bit integer will be scanned. For example, will return 2 with 30064771077 stored in var1 and -16 stored in var2 . Note that the integers returned are signed and cannot be represented by Tcl as unsigned values.
W This form is the same as w except that the data is interpreted as count 64-bit signed integers represented in big-endian byte order. For example, will return 2 with 21474836487 stored in var1 and -16 stored in var2 .
m The data is interpreted as count 64-bit signed integers represented in the native byte order of the machine running the Tcl script. It is otherwise identical to w and W . To determine what the native byte order of the machine is, refer to the byteOrder element of the tcl_platform array.
f The data is interpreted as count single-precision floating point numbers in the machine's native representation. The floating point numbers are stored in the corresponding variable as a list. If count is * , then all of the remaining bytes in string will be scanned. If count is omitted, then one single-precision floating point number will be scanned. The size of a floating point number may vary across architectures, so the number of bytes that are scanned may vary. If the data does not represent a valid floating point number, the resulting value is undefined and compiler dependent. For example, on a Windows system running on an Intel Pentium processor, will return 1 with 1.6000000238418579 stored in var1 .
r This form is the same as f except that the data is interpreted as count single-precision floating point number in little-endian order. This conversion is not portable to the minority of systems not using IEEE floating point representations.
R This form is the same as f except that the data is interpreted as count single-precision floating point number in big-endian order. This conversion is not portable to the minority of systems not using IEEE floating point representations.
d This form is the same as f except that the data is interpreted as count double-precision floating point numbers in the machine's native representation. For example, on a Windows system running on an Intel Pentium processor, will return 1 with 1.6000000000000001 stored in var1 .
q This form is the same as d except that the data is interpreted as count double-precision floating point number in little-endian order. This conversion is not portable to the minority of systems not using IEEE floating point representations.
Q This form is the same as d except that the data is interpreted as count double-precision floating point number in big-endian order. This conversion is not portable to the minority of systems not using IEEE floating point representations.
x Moves the cursor forward count bytes in string . If count is * or is larger than the number of bytes after the current cursor position, then the cursor is positioned after the last byte in string . If count is omitted, then the cursor is moved forward one byte. Note that this type does not consume an argument. For example, will return 1 with 0304 stored in var1 .
X Moves the cursor back count bytes in string . If count is * or is larger than the current cursor position, then the cursor is positioned at location 0 so that the next byte scanned will be the first byte in string . If count is omitted then the cursor is moved back one byte. Note that this type does not consume an argument. For example, will return 2 with 1 2 stored in var1 and 020304 stored in var2 .
@ Moves the cursor to the absolute location in the data string specified by count . Note that position 0 refers to the first byte in string . If count refers to a position beyond the end of string , then the cursor is positioned after the last byte. If count is omitted, then an error will be generated. For example, will return 2 with 1 2 stored in var1 and 020304 stored in var2 .
This procedure reads a string from a channel that was written by the previously presented writeString procedure:
This converts the contents of a file (named in the variable filename ) to base64 and prints them:

No comments:

Post a Comment