AdamPengC
AdamPengC

Reputation: 29

a "?" before the string

I want to use strings to input the path of files:

char** argv;
char* mytarget[2]={ (char*)"‪D:\\testlas\\BigOne.pcd",(char*)"‪‪D:\\testlas\\SmallOne.pcd" };
argv = mytarget;
for(int i=0;i<2;i++)
{
   std::cout << "m.name: " << argv[i] <<std::endl;
}

However, cout outputs:

m.name: ?‪D:\\testlas\\BigOne.pcd 
m.name: ?‪D:\\testlas\\SmallOne.pcd   

Why is there a ? before the strings?

I use VS2017 C++11.

I created a new program and used the code:

#include <iostream>
#include <string>
#include <cstring>
using namespace std;

int main()
{
    std::string test = "‪abc789";
    cout << test << endl;
    return 0; 
}

It also outputs "?abc789". Why?

Upvotes: -2

Views: 81

Answers (1)

dxiv
dxiv

Reputation: 17638

std::string test = "‪abc789";

There is a hidden LEFT-TO-RIGHT EMBEDDING character between the opening quote " and the first letter a (Unicode character U+202A, or UTF-8 E2 80 AA). Remove it, for example by deleting and retyping the line, then the ? will go away.

Upvotes: 4

Related Questions