Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 568723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:13:08+00:00 2026-05-13T13:13:08+00:00

In C++ I have a char[256] variable that is populated by a call to

  • 0

In C++ I have a char[256] variable that is populated by a call to an external DLL which fills it with data. From there I would like to add the char[] as a ComboBox item.

char name[256];
name[0] = "76";
comboBox1->Items->Add(name);

This creates a build error because char[] is not a type of System::Object. Any ideas on converting the char[] to something I can add as an Item to a ComboBox control? Converting to a string would be just fine but I’m not sure quite how to do that. Plus if I try to create a variable such as:

string strName;

also creates an error for missing ‘;’ before identifier ‘strName’. I’m a beginner to C++ and am still getting my brain wrapped around it so thanks for any help provided!

EDIT
Full code as requested:

#pragma once

namespace FMODMultipleSoundcardWindowed {

#include <string>
#include "inc/fmod.h"
#include "inc/fmod_errors.h"

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace std;


FMOD_SYSTEM     *systemA, *systemB;
FMOD_SOUND      *soundA, *soundB;
FMOD_CHANNEL    *channelA = 0, *channelB = 0;
FMOD_DSP        *dspNormalizerA, *dspNormalizerB;
FMOD_DSP        *dspCompressorA, *dspCompressorB;
FMOD_DSP        *dspEqualizerA[10], *dspEqualizerB[10];
FMOD_DSP        *dspVSTVUA, *dspVSTVUB;
FMOD_RESULT     result;
unsigned int    dspVSTVUHandleA, dspVSTVUHandleB;
unsigned int    version;
int             numdrivers, count;


public ref class Form1 : public System::Windows::Forms::Form
{
public:
    Form1(void)
    {
        InitializeComponent();

        result = FMOD_System_Create(&systemA);
        ERRCHECK(result);

        result = FMOD_System_GetVersion(systemA, &version);
        ERRCHECK(result);

        if (version < FMOD_VERSION)
        {
            MessageBox::Show("You are using an old version of FMOD!");
        }

        result = FMOD_System_GetNumDrivers(systemA, &numdrivers);
        ERRCHECK(result);

        for (count = 0; count < numdrivers; count++)
        {
            char name[256];

            result = FMOD_System_GetDriverInfo(systemA, count, name, 256, 0);
            ERRCHECK(result);

            m_objPrimaryAudioDeviceComboBox->Items->Add(name[0]);
        }
    }

    void ERRCHECK(FMOD_RESULT result)
    {
        if (result != FMOD_OK)
        {
            MessageBox::Show("FMOD Error!");
            this->Close();
        }
    }

protected:
    /// <summary>
    /// Clean up any resources being used.
    /// </summary>
    ~Form1()
    {
        if (components)
        {
            delete components;
        }
    }
private: System::Windows::Forms::ComboBox^  m_objPrimaryAudioDeviceComboBox;
protected: 
private: System::Windows::Forms::ComboBox^  m_objSecondaryAudioDeviceComboBox;

private:
    System::ComponentModel::Container ^components;

pragma region Windows Form Designer generated code

    void InitializeComponent(void)
    {
        this->m_objPrimaryAudioDeviceComboBox = (gcnew System::Windows::Forms::ComboBox());
        this->m_objSecondaryAudioDeviceComboBox = (gcnew System::Windows::Forms::ComboBox());
        this->SuspendLayout();
        // 
        // m_objPrimaryAudioDeviceComboBox
        // 
        this->m_objPrimaryAudioDeviceComboBox->FormattingEnabled = true;
        this->m_objPrimaryAudioDeviceComboBox->Location = System::Drawing::Point(12, 12);
        this->m_objPrimaryAudioDeviceComboBox->Name = L"m_objPrimaryAudioDeviceComboBox";
        this->m_objPrimaryAudioDeviceComboBox->Size = System::Drawing::Size(254, 21);
        this->m_objPrimaryAudioDeviceComboBox->TabIndex = 0;
        // 
        // m_objSecondaryAudioDeviceComboBox
        // 
        this->m_objSecondaryAudioDeviceComboBox->FormattingEnabled = true;
        this->m_objSecondaryAudioDeviceComboBox->Location = System::Drawing::Point(12, 54);
        this->m_objSecondaryAudioDeviceComboBox->Name = L"m_objSecondaryAudioDeviceComboBox";
        this->m_objSecondaryAudioDeviceComboBox->Size = System::Drawing::Size(254, 21);
        this->m_objSecondaryAudioDeviceComboBox->TabIndex = 1;
        // 
        // Form1
        // 
        this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
        this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
        this->ClientSize = System::Drawing::Size(440, 426);
        this->Controls->Add(this->m_objSecondaryAudioDeviceComboBox);
        this->Controls->Add(this->m_objPrimaryAudioDeviceComboBox);
        this->Name = L"Form1";
        this->Text = L"FMOD Multiple Soundcard with VST";
        this->ResumeLayout(false);

    }

pragma endregion

};

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T13:13:08+00:00Added an answer on May 13, 2026 at 1:13 pm
    string strName;
    

    First, you need to #include <string> in order to use std::string. Secondly, you need to add using namespace std; to your unit in order to refer to a std::stringas string. Alternatively, use the plain std::string strName instead. It’s a matter of taste. Using the fully qualified form avoids polluting your namespace with all the identifiers from std.

    To the main question:

    gcnew String( text.c_str() );
    

    This should do the conversion. text is your std::string instance and the result of the expression is the string object you need to pass to Add.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a char pointer which would be used to store a string. It
I have a loop that does the following: short fooID; char line[256] map<short,foo> foos;
I have taken char data into database into array. now i want to convert
I have a char variable, declared for example as: char a = 's'; How
I have declared a DLL import in my C# program that looks like this:
I have an error in my program which says that 'count' cannot be used
I have a closed source unmanaged DLL coded in C++ that I wanted to
I have a char [] output and its size is 256 bytes. I want
I have a couple of questions related to the following code: char buffer[256]; memset(buffer,0,256);
I have the following trivial Lua program which I copied from the book Programming

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.