jupyter-xeus / cpp-terminal

C++ library for writing multiplatform terminal applications
https://jupyter-xeus.github.io/cpp-terminal/
Other
490 stars 53 forks source link

Args #155 #283

Closed flagarde closed 1 year ago

flagarde commented 1 year ago

Allow to obtain the argc and argv everywhere in the program. Close #155. Maybe in the future we can do the same for envs but the args are more needed:


#include "cpp-terminal/args.hpp"

#include <iostream>

int main()
{
  std::cout << "argc : " << Term::argc << std::endl;
  for(std::size_t i = 0; i != Term::argc; ++i) { std::cout << "argv[" << i << "] : *" << Term::argv[i] << "*" << std::endl; }
  return 0;
}

On windows it returns utf-8 as it should !