נושאים פעיליםנושאים פעילים  הצגת רשימה של חברי הפורוםרשימת משתמשים  חיפוש בפורוםחיפוש  עזרהעזרה
  הרשמההרשמה  התחברותהתחברות RSS עדכונים
תיכנות
RSS UnderWarrior Forums : RSS תיכנות
נושא

נושא: זקוק לעזרה בהמרת קוד

שליחת תגובהשליחת נושא חדש
כותב
הודעה << נושא קודם | נושא הבא >>
nanoo
אורח
אורח


הצטרף / הצטרפה: 01 October 2003
משתמש: אונליין
הודעות: 12647
נשלח בתאריך: 28 December 2006 בשעה 18:34 | IP רשוּם
ציטוט nanoo

יש לי תוכנית בשפת C ואני מנסה להפעיל אותה בעזרת visual c++ express edition 2005
אני מקבל הודעות שגיאה וממש לא ברור לי למה...

אם יש דרך להעלות את הקוד אשמח מאוד לבצע ויתרה מכך, לעזרה.
חזרה לתחילת העמוד הצג את כרטיס החבר של nanoo חפש הודעות אחרות של nanoo בקר בדף הבית של nanoo
 
shoshan
מנהל האתר
מנהל האתר
סמל אישי

הצטרף / הצטרפה: 16 July 2005
מדינה: Israel
משתמש: מנותק/ת
הודעות: 4637
נשלח בתאריך: 28 December 2006 בשעה 22:29 | IP רשוּם
ציטוט shoshan

1. תעלה screenshot
2. תעתיק את השגיאה ותשלח אותה בצורה דומה לאיך ששולחים קוד
3. לשליחת קוד: קודי הפורום.
4. אם זה המרה מגרסה ישנה, כשתנסה לפתוח את ה-sln או את ה-csproj יפתח לך אשף המרה לגרסה הנוכחית, שמאוד הפתיע אותי ביעילותו...


__________________
עד מתי רשעים יעלוזו?

עַל כֵּן אֶמְאַס וְנִחַמְתִּי עַל עָפָר וָאֵפֶר.
חזרה לתחילת העמוד הצג את כרטיס החבר של shoshan חפש הודעות אחרות של shoshan בקר בדף הבית של shoshan
 
nanoo
אורח
אורח


הצטרף / הצטרפה: 01 October 2003
משתמש: אונליין
הודעות: 12647
נשלח בתאריך: 29 December 2006 בשעה 08:39 | IP רשוּם
ציטוט nanoo

זה הקוד המלא. ( למטה בסוף הודעות השגיאה)

קוד:

#include <dos.h>
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <stdlib.h>

#define com 1  //use com1

void initCom(void)
{
    union REGS inregs, outregs;

    inregs.h.ah = 0; // AH=0 - initilize comm port
    inregs.h.al = 0x43; // 300 baud, no parity, 8 bit data, 1 stop bit
    inregs.x.dx = com - 1;  // comm number: DX = 0 - com1, DX = 1 - com2
    int86(0x14, &inregs, &outregs); //use bios interrupt
    delay(200);
}

void send(char data)
{
    union REGS inregs, outregs;

    inregs.h.ah = 1; // AH=1 - send character
    inregs.h.al = data;
    inregs.x.dx = com - 1;  // comm number: DX = 0 - com1, DX = 1 - com2
    int86(0x14, &inregs, &outregs); //use bios interrupt
    delay(200);
}

char receve(void)
{
    union REGS inregs, outregs;
    while (1) {
        inregs.h.ah = 2; // AH=2 - receive character
        inregs.x.dx = com - 1;  // comm number: DX = 0 - com1, DX = 1 - com2
        int86(0x14, &inregs, &outregs); //use bios interrupt
        if (outregs.h.ah == 0)
            return(outregs.h.al);
    }
}

void main(void)
{           ;           //Chars : R - reset the transmitter
                    //        C - reset transmitter status
                    //          T + reseiver address - toggle reseiver
                    //        S - get status from transmitter (last operation)
                    //          After S transmitter send byte to computer :
                    //          D7 D6 D5 D4 D3 D2 D1 D0
                    //        |  |  |  |  |  |  |  |
                    //        |  |  |  |  |  |  |  relay status
                    //        |  |  |  |  don't care
                    //        |  |  |  unknown command
                    //        |  |  timeout error
                    //        |  busy write
                    //        busy read
    unsigned char status;
    char address [10];
    int index;

    clrscr();
    initCom();   //Initilize comm port

    send('R');   //reset the transmiter
    send('S');   //Get status from transmiter
    status = receve();
    /* printf("Status : %X \n", status); */
    if (status == 0)
        printf("Transmitter ready\n");
    else {
        printf("Transmitter not ready\n");
        exit(1);
    }

    printf("˜ƒ™Œ „–…˜ А„™ š…š‹ ˜”‘Ž ™—„ -->");
    scanf("%s",address);

    send('T');   //„€„ „ƒ…—” š‡Œ™ …š…š‹™ ˆŒ—Ž„ –Ž š€ Š…”„
    for (index = 0; index < strlen(address); ++index)
        send(address[index]);
    send(';');

    do {
        send('S');   //Get status from transmiter
        send(0xD);
        status = receve();
        /* printf("Status : %X \n", status); */
        if ((status & 0x80) > 0)
            printf("busy read\n");
        if ((status & 0x40) > 0)
            printf("busy write\n");
        if ((status & 0x20) > 0) {
            printf("timeout error\n");
            exit(1);
        }
    } while ((status != 1) && (status != 0));
    if (status == 1) printf("Unit On\n");
    if (status == 0) printf("Unit Off\n");
}


הודעות השגיאה

קוד:

Compiling...
1.cpp
d:\project\1.cpp(11) : error C2079: 'inregs' uses undefined union 'initCom::REGS'
d:\project\1.cpp(11) : error C2079: 'outregs' uses undefined union 'initCom::REGS'
d:\project\1.cpp(13) : error C2228: left of '.h' must have class/struct/union
        type is 'int'
d:\project\1.cpp(13) : error C2228: left of '.ah' must have class/struct/union
d:\project\1.cpp(14) : error C2228: left of '.h' must have class/struct/union
        type is 'int'
d:\project\1.cpp(14) : error C2228: left of '.al' must have class/struct/union
d:\project\1.cpp(15) : error C2228: left of '.x' must have class/struct/union
        type is 'int'
d:\project\1.cpp(15) : error C2228: left of '.dx' must have class/struct/union
d:\project\1.cpp(16) : error C3861: 'int86': identifier not found
d:\project\1.cpp(17) : error C3861: 'delay': identifier not found
d:\project\1.cpp(22) : error C2079: 'inregs' uses undefined union 'send::REGS'
d:\project\1.cpp(22) : error C2079: 'outregs' uses undefined union 'send::REGS'
d:\project\1.cpp(24) : error C2228: left of '.h' must have class/struct/union
        type is 'int'
d:\project\1.cpp(24) : error C2228: left of '.ah' must have class/struct/union
d:\project\1.cpp(25) : error C2228: left of '.h' must have class/struct/union
        type is 'int'
d:\project\1.cpp(25) : error C2228: left of '.al' must have class/struct/union
d:\project\1.cpp(26) : error C2228: left of '.x' must have class/struct/union
        type is 'int'
d:\project\1.cpp(26) : error C2228: left of '.dx' must have class/struct/union
d:\project\1.cpp(27) : error C3861: 'int86': identifier not found
d:\project\1.cpp(28) : error C3861: 'delay': identifier not found
d:\project\1.cpp(33) : error C2079: 'inregs' uses undefined union 'receve::REGS'
d:\project\1.cpp(33) : error C2079: 'outregs' uses undefined union 'receve::REGS'
d:\project\1.cpp(35) : error C2228: left of '.h' must have class/struct/union
        type is 'int'
d:\project\1.cpp(35) : error C2228: left of '.ah' must have class/struct/union
d:\project\1.cpp(36) : error C2228: left of '.x' must have class/struct/union
        type is 'int'
d:\project\1.cpp(36) : error C2228: left of '.dx' must have class/struct/union
d:\project\1.cpp(37) : error C3861: 'int86': identifier not found
d:\project\1.cpp(38) : error C2228: left of '.h' must have class/struct/union
        type is 'int'
d:\project\1.cpp(38) : error C2228: left of '.ah' must have class/struct/union
d:\project\1.cpp(39) : error C2228: left of '.h' must have class/struct/union
        type is 'int'
d:\project\1.cpp(39) : error C2228: left of '.al' must have class/struct/union
d:\project\1.cpp(61) : error C3861: 'clrscr': identifier not found
d:\project\1.cpp(79) : warning C4018: '<' : signed/unsigned mismatch



חזרה לתחילת העמוד הצג את כרטיס החבר של nanoo חפש הודעות אחרות של nanoo בקר בדף הבית של nanoo
 
nanoo
משתמש מתחיל
משתמש מתחיל


הצטרף / הצטרפה: 29 December 2006
משתמש: מנותק/ת
הודעות: 1
נשלח בתאריך: 01 January 2007 בשעה 20:04 | IP רשוּם
ציטוט nanoo

מישהו מהחברים יוכל אולי לעזור לי בצורה אחרת ?

קוד לדוגמא שמאפשר לכתוב byte אחד ליציאה סיריאלית ולקרוא ממנה את התשובה ?


חזרה לתחילת העמוד הצג את כרטיס החבר של nanoo חפש הודעות אחרות של nanoo
 
shoshan
מנהל האתר
מנהל האתר
סמל אישי

הצטרף / הצטרפה: 16 July 2005
מדינה: Israel
משתמש: מנותק/ת
הודעות: 4637
נשלח בתאריך: 01 January 2007 בשעה 20:13 | IP רשוּם
ציטוט shoshan

רק תיקון למה שכתבתי למעלה, כשדיברתי על המרת קוד טובה חשבתי שאתה מדבר על c# משום מה.

__________________
עד מתי רשעים יעלוזו?

עַל כֵּן אֶמְאַס וְנִחַמְתִּי עַל עָפָר וָאֵפֶר.
חזרה לתחילת העמוד הצג את כרטיס החבר של shoshan חפש הודעות אחרות של shoshan בקר בדף הבית של shoshan
 

אם ברצונך להגיב לנושא זה עליך קודם להתחבר
אם אינך רשום/ה כבר עליך להרשם

  שליחת תגובהשליחת נושא חדש
גרסת הדפסה גרסת הדפסה

קפיצה לפורום
אינך יכול/ה לשלוח נושאים חדשים בפורום זה
אינך יכול/ה להגיב לנושאים בפורום זה
אינך יכול/ה למחוק את הודעותיך ותגוביך בפורום זה
אינך יכול/ה לערוך את הודעותיך ותגובותיך בפורום זה
אינך יכול/ה לצור סקרים בפורום זה
אינך יכול/ה להצביע בסקרים בפורום זה