Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

C Syntax Help Needed...

Featured Replies

  • Moderator

I have an urgent need to update my sound module to allow for increased flexibility by the users.

 

I have been using a predefined path to the sim's ..\Sound folder such as the following:

 

(GaugePlaySound)("sound\\LHC_X\\SND1.wav","",0)

 

I already know how to use the "fifth parameter" of the gauge entry to include a relative path, such as the following:

 

gauge00=LHC_X_Sound!SoundModule, 0,0,1,1,SimObjects\\Airplanes\\MyAirplane\\panel\\sound

CHAR sound_Path[MAX_PATH] = "";
int params_read = 0;
 
case PANEL_SERVICE_POST_INSTALL:
if (pgauge->parameters && params_read == 0)
{
if ( strlen(pgauge->parameters) > 0 )
{
strcpy(sound_Path,(PCHAR)(pgauge->parameters)); params_read = 1;
}
 
else if ( strlen(pgauge->parameters) == 0 )
{
params_read = 1;
}

What I don't know however is the correct syntax for concantenating the char variable sound_Path so that it will replace the characters highlighted in red:

 

(GaugePlaySound)("sound\\LHC_X\\SND1.wav","",0)

 

Could it possibly be as simple as this:

(GaugePlaySound)(strcat(sound_Path,\\SND1.wav),"",0)

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator
  • Author
  • Moderator

strcat(sound_Path,"\\Snd1.wav")

 

Hugo

So, maybe I did guess correctly:

(GaugePlaySound)(strcat(sound_Path,"\\Snd1.wav"),"",0)

I have 200 such entries, so I want to be certain before I do any Search/Replace operation... :Drooling:

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

NO,NO,NO,

 

strcat(Sound_path,\\SND1.wav)  

 

is NOT the same as  

 

strcat(Sound_path,"\\SND1.wav")  .

 

Sound_path is a variable containing a string, but  \\SND1.wav in the first statement is meaningless and the compiler will generate an error for it.

 

In the  second statement "\\Snd1.wav" creates locally a new string  and the address of this string will be the second parameter for the strcat routine with the wanted result.

  • Author
  • Moderator

Actually, I did have it correct, but this bloody POS forum editor kept stripping out the quote marks!

 

It took three tries, but I finally coaxed the "code box" to behave itself and (re)edited my previous post...

  :sorry:

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.