Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente di HTML.it
    Registrato dal
    Oct 2007
    Messaggi
    331

    [C - C++] da C++ a ANSI C

    Salve a tutti, ho questo codice C++:

    codice:
    static PUINT8 deviceID = NULL;
    UINT8 temp[32] = {0};
    
    deviceID = new UINT8[deviceNum];
    memcpy(deviceID, temp, deviceNum * sizeof(UINT8));
    temp viene valorizzato prima della new.
    E vorrei fare la stessa cosa senza usare la new in modo da avere un codice compilabile con la direttiva /TC piuttosto che /TP (quella del C++) in ambiente Visual Studio 2005/2008.

    Basta fare la malloc al posto della new?

  2. #2
    Utente di HTML.it L'avatar di shodan
    Registrato dal
    Jun 2001
    Messaggi
    2,381
    Si. Finché non si tratta di oggetti almeno.
    This code and information is provided "as is" without warranty of any kind, either expressed
    or implied, including but not limited to the implied warranties of merchantability and/or
    fitness for a particular purpose.

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.