开发者

What's wrong with the c++ code below?

开发者 https://www.devze.com 2023-01-12 05:12 出处:网络
HRESULT SaveGraphFile(IGraphBuilder *pGraph, WCHAR *wszPath) { const WCHAR wszS开发者_高级运维treamName[] = L\"ActiveMovieGraph\";
HRESULT SaveGraphFile(IGraphBuilder *pGraph, WCHAR *wszPath) 
{
    const WCHAR wszS开发者_高级运维treamName[] = 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 is reporting:

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

Why is | regarded an identifier ?


Your pipes aren't really pipes. The character between the STGM constants should be | (ASCII 124), but what you have is ¦ (ASCII 166, which isn't strictly speaking ASCII at all). It looks like you're the victim of a faulty copy-paste.


I would try to remove the constants one by one until all pipes are gone or put the expression with the constants in a variable of its own and use that instead.

0

精彩评论

暂无评论...
验证码 换一张
取 消