الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

مشكلة عندى فى الكود (خطاء)مهم جداجدا

بدأه elmasre73 في 2 يوليو 2011 · 3 رد · 341 مشاهدة · في الأسئلة المجابة
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم ورحمة الله وبركاته

527705841.jpg

603952565.jpg



#include "stdio.h"
#include "string.h"
void main ( int argc, char * argv[] )
{
//here argc should be 4 since we have 4 arguments
//argv is an array of strings, each string holding an argument
//argv[0] equals the filename "mbad", argv[1] equals "-a" or "-d"
//argv[2] equals the input file name, argv[3] equals the output file name
if (! ( ( argc == 4) && ( strcmp(argv[1],"-a")==0 || strcmp(argv[1],"-d")==0 ) ) )
{
//here if the user enters the command line arguments incorrectly, we print a
//help message as specified in the project pdf file
printf( "Usage %s [-h|-a|-d] [fname1 fname2]\n", argv[0]);
printf ("-a takes assembly and produces machine code, both file names must be given\n");
printf ("-d takes machine code and produces assembly, both file names must be given\n");
}
else
{
FILE * fIn = fopen ( argv[2], "r" );
FILE * fOut = fopen ( argv[3], "w" );
if ( fIn == NULL )
{
printf( "Could not open input file\n" );
}
else
{
if ( strcmp(argv[1],"-a")==0 )
{
//Convert from assembly to machine code
//...
//...
printf ("Conversion from assembly to machine code done successfully\n");
}
else // here argv[1] will be equal "-d"
{
//Convert from machine code to assembly
//...
//...
printf ("Conversion from machine code to assembly done successfully\n");
}
fclose (fIn);
fclose (fOut);
}
}
}


#2

نسيت وضع امتداد (لاحقة - extension) الملف.

* يرجى مراجعة قواعد المشاركة واختيار عنوان مناسب في المرات القادمة.

2

Do as I say, not as I do

We are Anonymous. We are Legion. We don't forgive. We don't forget

#3

شغال عندي تمام تأكد من الامتداد بتاع الملف؟ ممكن انت بتدخل in وهو in.txt

No intellectual battle was ever won through retreat
You do not watch Gintama? Dude, you are missing a lot!


صورةmsrgb1485.gif ocajavase7programmerclr.gif

#4
mental-driller كتب:

شغال عندي تمام تأكد من الامتداد بتاع الملف؟ ممكن انت بتدخل in وهو in.txt

جزاكم الله خيرا اشتغل

اقتباس
* يرجى مراجعة قواعد المشاركة واختيار عنوان مناسب في المرات القادمة.

اسف ان شاء الله المرة القادمة هختار عوان انسب

مواضيع مشابهة