添付の2点のソースから、汎用性のある.exeを得たい。 – プログラミング – Home

添付の2点のソースから、汎用性のある....
 
通知
すべてクリア

[解決済] 添付の2点のソースから、汎用性のある.exeを得たい。


かず
 かず
(@かず)
ゲスト
結合: 7年前
投稿: 3
Topic starter  

お世話になっております。
下記2つのプログラムが、Windows下、Visual Studio 2005では通り、
動いているのですが、
これを
Cコンパイラ―を持っていない人でも、使える .exe
の形で欲しいと思っています。Visual Studioの
.exe では、このような汎用性がありませんが、
確か BorlandのC++で、コンパイルをかけた場合は、
C コンパイラ―を持ってない人でも、そのアプリケーションを使えたと
記憶しています。
どなたか、お手数ですが、添付の2点のプログラムを、皆が使えるような
.exe が得られるように、
それなりのコンパイラ―で、かけていただけないでしょうか?


引用未解決
トピックタグ
かず
 かず
(@かず)
ゲスト
結合: 7年前
投稿: 3
Topic starter  

#include <stdlib.h>
#include <windowsx.h>
#include <process.h>  
#include <math.h>   
#include <windows.h>
#include <shellapi.h>
#include <stdio.h>
#include <math.h>
#include <MMSystem.h>
#pragma comment(lib,winmm.lib)

int main (void)
{
FILE *fA;
int L;
int Vol,F;
int P;
int S;
int Sus_Per = 10000;
int Header[44] =
{82,73,70,70,36,113,2,0,87,65,86,69,102,109,116,32,16,0,0,0,1,0,1,0,128,62,0,0,128,62,0,0,1,0,8,0,100,97,116,97,0,113,2,0};
int K;
int L1,L2;

Input_Define:;

printf(Please type the below 2 inputs putting space and press Enter key. \n);
printf(How many dB is the sound strength ? \n);
printf(Specify 1 to 100 as its volume (dB). \n);
printf(How many Hz are you setting as sound emitting fequency ? \n);
printf(Specify any value between 400 to 500. \n);
printf(\n);
scanf(%d %d,&Vol,&F);

printf(\n);
printf(\n);

if (Vol < 1 || Vol > 100)
{
printf(Specify any value between 1 to 100 as its volume (dB) once more. \n);
printf(\n);
goto Input_Define;
}

if (F < 400 || F > 500)
{
printf(Specify any vaue between 400 to 500 as sound emitting fequency
once more. \n);
printf(\n);
goto Input_Define;
}

if ((fA = fopen(Output.wav,wb+)) == NULL)
{

printf(Formant Frequency File's open error!!\n);
exit(4);
}

for (L=0;L<44;L++)
fputc(Header[L],fA);

for (L=0;L<(16000*10);L++)
{
S = L/16000;
P = Vol*sin((2*3.1416*(L-16000*S)*F)/16000);

// printf(Present Offset = %d \n,P);

/*
if ((L-S*16000) < 10)
P = P*(L-16000*S)/10;

if ((L-S*16000) >= 15990)
P = P*(16000*(S+1) - L)/10;
*/

P = P + 0X80;

fputc(P,fA);
}

fclose(fA);

printf( When you want to stop the sound, \n);
printf(
Just quit from command console, please. \n);

for (K=0;K<Sus_Per;K++)
{
PlaySoundA(Output.wav, NULL,SND_FILENAME|SND_ASYNC);
for (L1=0;L1<60500;L1++)
for (L2=0;L2<10000;L2++)
L2 = L2;
}

return 0;
}


返信引用
かず
 かず
(@かず)
ゲスト
結合: 7年前
投稿: 3
Topic starter  

#include <stdlib.h>
#include <windowsx.h>
#include <process.h>  
#include <math.h>   
#include <windows.h>
#include <shellapi.h>
#include <stdio.h>
#include <math.h>
#include <MMSystem.h>
#pragma comment(lib,winmm.lib)

int main (void)
{
FILE *fA;
int L;
int F;
int P;
int Vol,Sus_Per;
int Header[44] =
{82,73,70,70,36,113,2,0,87,65,86,69,102,109,116,32,16,0,0,0,1,0,1,0,128,62,0,0,128,62,0,0,1,0,8,0,100,97,116,97,0,113,2,0};
int K;
int L1,L2;

Input_Define:;

printf(Please type the below 2 inputs putting space and press Enter key. \n);
printf(How many dB is the sound strength ? \n);
printf(Specify 1 to 100 as its volume (dB). \n);
printf(How many decades of seconds should the ringing be sustainded on every
fixed frequency for, \n);
printf(raising it from 400 to 500 Hz, by 1 Hz ? \n);
printf(Specify 1 to 200 as its period (10 times seconds). \n);
printf(\n);
scanf(%d %d,&Vol,&Sus_Per);

printf(\n);
printf(\n);

if (Vol < 1 || Vol > 100)
{
printf(Specify 1 to 100 as its volume (dB) once more. \n);
printf(\n);
goto Input_Define;
}

if (Sus_Per < 1 || Sus_Per > 200)
{
printf(Specify 1 to 200 as its period (10 times seconds) once more. \n);
printf(\n);
goto Input_Define;
}

for (F=400;F<500;F++)
{

if ((fA = fopen(Output.wav,wb+)) == NULL)
{

printf(Formant Frequency File's open error!!\n);
exit(4);
}

for (K=0;K<Sus_Per;K++)
{
for (L=0;L<44;L++)
fputc(Header[L],fA);

for (L=0;L<(16000*10);L++)
{
P = Vol*sin((2*3.1416*L*F)/16000);
P = P + 0X80;
fputc(P,fA);
}

fclose(fA);
PlaySoundA(Output.wav, NULL,SND_FILENAME|SND_ASYNC);
for (L1=0;L1<60500;L1++)
for (L2=0;L2<10000;L2++)
L2 = L2;
}

}

return 0;
}


返信引用
YuO
 YuO
(@YuO)
ゲスト
結合: 21年前
投稿: 320
 

普通にReleaseビルドしたらいいと思いますが,それでは何が問題なのでしょうか。
VC++2005再頒布可能モジュールのインストールを嫌うのであれば,CRTごとリンクすればいいわ
けですし。


返信引用
ITO
 ITO
(@ITO)
ゲスト
結合: 22年前
投稿: 1235
 

「スタチックライブラリーでMFCを使用する。」を使えばいいのでは?
Windowsの環境はなんですか?windows10を使うのであれば、VisualCのバージョンが
低すぎですね。


返信引用
ITO
 ITO
(@ITO)
ゲスト
結合: 22年前
投稿: 1235
 

訂正、
>「スタチックライブラリーでMFCを使用する。」を使えばいいのでは?
設定で「スタチックライブラリーでMFCを使用する。」を選択すればいいのでは?

Frameworkを使う手もありますね。
Ver 4.XXあたりで自動更新でインストールされるのがありますね。

>確か BorlandのC++で、コンパイルをかけた場合は、
WINDOWS XPまでしか対応してないですね。
プラットフォームSDKをインストールしないとだめですね。


返信引用
かず
 かず
(@かず)
ゲスト
結合: 23年前
投稿: 62
 

皆さま、ありがとうございます。

2005でも、Releaseビルドしたら
汎用性のある.exeが出来ました。
お礼をもうしあげます。


返信引用

返信する

投稿者名

投稿者メールアドレス

タイトル *

プレビュー 0リビジョン 保存しました
共有:
タイトルとURLをコピーしました