※ ChatGPTを利用し、要約された質問です(原文:実行結果の判定の”良否”が分かりません!?)
実行結果の判定の”良否”が分かりません!?
このQ&Aのポイント
実行結果の判定が分からず、bcc32のセットアップが成功したかわかりません。
example9.cのプログラムを試しに実行したところ、ファイルが開けないという警告が表示されました。
参考書にはfopenできないと出るはずなのに、パラメータが使用されていないという警告が表示されました。
https://www.youtube.com/watch?v=MJ9qrhJFdHE
をもとに bcc32をインストールしました。
コマンド プロンプトから
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\Administrator>bcc32
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
Syntax is: BCC32 [ options ] file[s] * = default; -x- = turn switch x off
-3 * 80386 Instructions -4 80486 Instructions
-5 Pentium Instructions -6 Pentium Pro Instructions
-Ax Disable extensions -B Compile via assembly
-C Allow nested comments -Dxxx Define macro
-Exxx Alternate Assembler name -Hxxx Use pre-compiled headers
-Ixxx Include files directory -K Default char is unsigned
-Lxxx Libraries directory -M Generate link map
-N Check stack overflow -Ox Optimizations
-P Force C++ compile -R Produce browser info
-RT * Generate RTTI -S Produce assembly output
-Txxx Set assembler option -Uxxx Undefine macro
-Vx Virtual table control -X Suppress autodep. output
-aN Align on N bytes -b * Treat enums as integers
-c Compile only -d Merge duplicate strings
-exxx Executable file name -fxx Floating point options
-gN Stop after N warnings -iN Max. identifier length
-jN Stop after N errors -k * Standard stack frame
-lx Set linker option -nxxx Output file directory
-oxxx Object file name -p Pascal calls
-tWxxx Create Windows app -u * Underscores on externs
-v Source level debugging -wxxx Warning control
-xxxx Exception handling -y Produce line number info
-zxxx Set segment names
以上でbcc32のセットアップの成功の有無が分かると思いますが、私はよくわかりません!?
次に
C:\Users\Administrator>bcc32
として
それでファイル名がexample9.cの以下のプログラムを
試しに、
#include <stdio.h>
int main(int argc, char *argv[])
{
FILE *fp;
fp = fopen(argv[1], "r");
if ( fp == NULL ){
printf("fopen dekinai\n");
return -1;
}
fclose(fp);
return 0;
}
以上のプログラムのexample9.cのファイルを
コマンドプロンプトにドラックアンド ドロップ
したところ、
C:\Users\Administrator>bcc32 C:\Users\Administrator\Desktop\C言語\SOURCE\Chap12\1201\example9.c
となり、Enterキーを押して、
以下の結果が出ました。
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
C:\Users\Administrator\Desktop\C言語\SOURCE\Chap12\1201\example9.c:
警告 W8057 C:\Users\Administrator\Desktop\C言語\SOURCE\Chap12\1201\example9.c 12
: パラメータ 'argc' は一度も使用されない(関数 main )
Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland
C:\Users\Administrator>
以上example9.cの実行結果は、 参考書には fopen dekinai と出ています。
しかし
パラメータ 'argc' は一度も使用されない(関数 main )・・・
と出ています。
※なぜ fopen dekinai と出ないのでしょうか!?
よろしくお願いします。
お礼
すみません、お返事が遅くなりました。 そうですね!基本的な、コンパイルがされていないので、実行できない のは当たり前のことですね^^ gccソフトが古くて、OS7以降に未対応なので、困っています。 Visual Studioもいまいちやり方がわからないので困っています。 なので理論的な勉強しかできません_ _ ありがとうございました。 今後ともまたバカない質問するので、よろしくお願いします。
補足
ありがとうございます。 現在ご回答を解析中です。 しばらくお待ちください。