What is wrong with the C ++ code below?

HRESULT SaveGraphFile(IGraphBuilder *pGraph, WCHAR *wszPath) 
{
    const WCHAR wszStreamName[] = L"ActiveMovieGraph"; 
    HRESULT hr;
    IStorage *pStorage = NULL;

    // First, create a document file that will hold the GRF file
    hr = StgCreateDocfile(
         wszPath,
         STGM_CREATE │ STGM_TRANSACTED │ STGM_READWRITE │ 
            STGM_SHARE_EXCLUSIVE,
         0, &pStorage);
    ....

I copied it somewhere, but the compiler reports:

syntax error : missing ')' before identifier '│'

Why |is it considered an identifier?

+3
source share
2 answers

Your pipes are not really pipes. The character between the constants STGMshould be |(ASCII 124), but you have one ¦(ASCII 166, which does not mean ASCII at all). It looks like you have been the victim of an erroneous copy.

+12
source

I would try to remove the constants one by one until all pipes go away or put an expression with constants in its own variable and use this.

0
source

Source: https://habr.com/ru/post/1760760/


All Articles