Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
A

anti AS

@anti AS
About
Posts
10
Topics
4
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Mixed C++/CLI code with Berkeley DB
    A anti AS

    I tried to make the key size (In Query operation) dynamic with "for" loop as the code below.. this was without any benefit:

    for (int i=1;i<90000000; i++){
    getKey.set_size(i);
    getData.set_data(DDData);
    getData.set_ulen(28);
    getData.set_flags(DB_DBT_USERMEM);
    if(SigDb.get(NULL,&getKey,&getData,0)!=DB_NOTFOUND)
    Console::WriteLine(" {0},,{1}",Marshal::PtrToStringUni((IntPtr)DDData),i);
    }
    Marshal::FreeHGlobal(IntPtr(a));
    Console::WriteLine("Finish");

    Managed C++/CLI database c++ dotnet data-structures

  • Mixed C++/CLI code with Berkeley DB
    A anti AS

    I am not sure if i understood you. I made the followin in the second code but still same problem:

    wchar\_t DDData\[14\];
    Dbt getKey, getData;
    getKey.set\_data(a);
    
    getKey.set\_size(HexSig->Length);
    getData.set\_data(DDData);
        getData.set\_ulen(HexSig->Length);
    getData.set\_flags(DB\_DBT\_USERMEM);
    
    Managed C++/CLI database c++ dotnet data-structures

  • Mixed C++/CLI code with Berkeley DB
    A anti AS

    Hi, I'm traying to use Berkeley DB in C++/CLI with /clr mode. I wrote two applications, one will store to a database and another one will try to read the contents of that database, but i failed in doing that! This the first code (first app) for writing to a database:

    #include "stdafx.h"
    #pragma comment(lib,"libdb51")
    using namespace System;
    using namespace System::Runtime::InteropServices;

    int main(array<System::String ^> ^args)
    {
    Db SigDb(0,0);
    unsigned int oFlags= DB_CREATE;
    SigDb.open(NULL,"SigDb.db",0,DB_BTREE,oFlags,0);
    String^ HexSig="1E81F1C1176434";
    wchar_t* a=( wchar_t* )Marshal::StringToHGlobalUni(HexSig).ToPointer() ;
    wchar_t* A=( wchar_t* )Marshal::StringToHGlobalUni(HexSig).ToPointer();;

    Dbt key1(a,100);
    Dbt data1(A,100);

    int ret= SigDb.put(NULL,&key1,&data1, DB_NOOVERWRITE);
    if(ret==DB_KEYEXIST){
    Console::WriteLine("You are trying to insert an exist key!");
    }

    SigDb.close(0);
    Marshal::FreeHGlobal(IntPtr(A));
    Marshal::FreeHGlobal(IntPtr(a));
    return 0;
    }

    and this is the second code for reading from the database:

    #include "stdafx.h"
    #pragma comment(lib,"libdb51")
    using namespace System;
    using namespace System::Runtime::InteropServices;

    int main(array<System::String ^> ^args)
    {
    Db SigDb(0,0);
    unsigned int oFlags= DB_CREATE;
    SigDb.open(NULL,"SigDb.db",0,DB_BTREE,oFlags,0);
    String^ HexSig="1E81F1C1176434";
    wchar_t* a=( wchar_t* )Marshal::StringToHGlobalUni(HexSig).ToPointer();

    SigDb.open(NULL,"SigDb.db",0,DB_BTREE,oFlags,0);
    wchar_t DDData[200];
    Dbt getKey, getData;
    getKey.set_data(a);

    getKey.set_size(100);
    getData.set_data(DDData);
    getData.set_ulen(200);
    getData.set_flags(DB_DBT_USERMEM);

    if(SigDb.get(NULL,&getKey,&getData,0)==DB_NOTFOUND)
    Console::WriteLine("Not Found !");
    else
    Console::WriteLine(" {0}",Marshal::PtrToStringUni((IntPtr)DDData));

    Marshal::FreeHGlobal(IntPtr(a));

    Console::ReadLine();
    return 0;
    }

    always the second app says "Not found"! On the other hand when i tried to write the same data twise in the database using the first code, it says "You are trying to insert an exist key!" and that proves that the data was written! Any idea pls!

    Managed C++/CLI database c++ dotnet data-structures

  • std::string to System::String conversion
    A anti AS

    what about

    St = gcnew String(str);

    or

    using namespace System::Runtime::InteropServices;
    ...
    ...
    St = Marshal::PtrToStringAnsi((IntPtr)str);

    Managed C++/CLI tutorial

  • Confusing between Native and Managed !??
    A anti AS

    Thank u N a v a n e e t h... great information ... btw the native array will be considered as unverifiable unlike the managed one. ;)

    Managed C++/CLI question c++ dotnet data-structures

  • Confusing between Native and Managed !??
    A anti AS

    Hi If i use /clr mode to compile a code that has somthing like the following:

    int x = 3;
    char ch='A';
    int arr[]="Hi";
    array^ ManArr1={44};
    array^ ManArr2= gcnew array {44};

    my questions now: Would the type int be mapped to System::Int32 ?? and what about char ch ? Are they considerd as native or managed type? Where will be executed! through MSIL or not!! We see that int arr[] is a native array, does that mean it will be executed out of MSIL?:confused: The last question ;) ,, For both the managed array ManArr1 & ManArr2 what is the difference between the two initialization ??

    Managed C++/CLI question c++ dotnet data-structures

  • Inline processor assembly language in C++/CLI
    A anti AS

    Hi Do we have ability to write inline assembly code in managed C++/CLI Thanks in advance!

    Managed C++/CLI c++

  • Difference between IJW and #pragma unmanaged ?
    A anti AS

    :thumbsup: Great man... It is more clear now. Thank you.

    Managed C++/CLI c++ question

  • Difference between IJW and #pragma unmanaged ?
    A anti AS

    Thanx Nish If I use standard C function inside CPP/CLI code .. like for example:

    ManagedFunction(){
    ..... Managed Code .....
    ..... Managed Code .....
    printf("I am standard C function!\n");
    ..... Managed Code .....
    ..... Managed Code .....
    }

    Does MSIL do something with the printf() function! (Notice that i did NOT use #pragma umanaged directive!) If MSIL will do nothing with printf() so (as i think) printf() will be compiled as native??So why I need to use #pragma umanaged directive.

    Managed C++/CLI c++ question

  • Difference between IJW and #pragma unmanaged ?
    A anti AS

    Hi guys In C++/CLI what is the difference between using the concept of IJW (It Just Works) and using pragma directive as following:

    #pragma managed(push,off)
    UnmanagedFunc(){
    …native code …
    }
    #pragma managed(pop)

    Does IJW is enabled automatically (so just need to write our native code) or we need to do something to make it works..?? In other mean, what is the advantage of IJW over using pragma directive or the other way around??

    Managed C++/CLI c++ question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups