Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

65
Visualizações
Grab the text inputted in the console after running a program in C

I'm not sure exactly if the title made it clear, but I want to save the text typed in the same line while executing a program in C.

For example, if I type: ./myprogram samplestring

I want to save samplestring as a variable in the C program. Not sure if this is possible or not, and sorry if I'm not being clear, I'm a bit confused.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

From here:

#include <stdio.h>

int main (int argc, char *argv[])
{
  int count;

  printf ("This program was called with \"%s\".\n",argv[0]);

  if (argc > 1)
  {
      for (count = 1; count < argc; count++)
      {
          printf("argv[%d] = %s\n", count, argv[count]);
      }
  }
  else
  {
      printf("The command had no other arguments.\n");
  }

  return 0;
}
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda