Thread: got confused which specifier to use ?!

  1. #1
    بابلی ریکا Masterx's Avatar
    Join Date
    Nov 2007
    Location
    Somewhere nearby,Who Cares?
    Posts
    497

    got confused which specifier to use ?!

    hello , there are some problems here !
    first when i try to compile these codes i get negetive numbers while im supposed to get positive ones! i used different specifiers such as "%ld, %d , %i, %u ,and etc .and all i knew in order to check if one could give me a close answer! but no luck ...
    the number i should get is sth like 1,475,365 or so , that according to my knowledge an unsigned long should give me that! or i can get such number with a "long" specifier ... any way when i try to use a long specifier i only get an irrelevant number of 136,465,321 or stuff like that ! well im using an ancient compiler name TC version 3 .. cause i need to program under dos and 16 bit based progs .. im tring on these .so a compiler like Tc can do the job for me ..but as you all know its only supports C90 standard! and i have difficulties using INT_MAX and stuff like that ...
    please help me on this

    and the second problem is that ..when i palce the whole structure above the "main() function " in order to use other functions to organize the whole program ... it just wont run ! it compiles without any problem ! but when i press "Enter" to start the program it just exits ! why ? !! is there any way to use functions ?
    (if you notice you will see i commented a function that used to call FAT infos to be printed on screen ! thats why i commented it ! )

    well, ill be really very happy if you help me n this

    thanx in advance and i appreciate your kind help

    Code:
    //In the name of GOD
    
    //version 0.1.0
    
    /* Using Structure to hold data+Floppy disk stats
    Original code :A Piece of COde that extracts floppy disk geometry information, 
    its  been writen in pure C and has been tested and ran seccessfully under TC 3 ...
    Added session:Floppy Disk Stat reader!, it is intended to show the floppy
    -disk information rather than its FAT info or floppy geometry!
     Cod3r :Seyyed HOssein hasn pour in NOvember 12th 2007
     www.PersianOs.org*/
    //##################Define Session######################
    typedef unsigned char BYTE;
    typedef short  int     WORD;
    typedef int          DWORD;
    //###################Main Session#######################
    void profile_1(void);
    //void FLOPPY_STATS(void);
    #include <stdio.h>
    #include <process.h>
    #include <string.h>
    #include <conio.h>
    #include <dos.h>
    
    
     int main(void)
    {
    //###################Structure To hold data#############
    struct Floppy_DISK_INFORMATION
    {
       BYTE jumpCode[3];
       BYTE oemName[8];
       WORD bytes_Sector;
       BYTE sec_Cluster;
       WORD size_Sector_Reserved;
       BYTE fatCount;
       WORD Max_Root_Entry;
       WORD Total_Sector_FS;
       BYTE Media_Type;
       WORD sectors_per_fat;
       WORD sectors_per_track;
       WORD total_Head_Count;
       DWORD no_Sectors_Before_Part;
       DWORD no_Sector_FS32;
       BYTE BIOS_13h_Drive_No;
       BYTE reserved;
       BYTE ext_Boot_Part_Signature;
       DWORD vol_Serial_Number;
       BYTE vol_Label_Name[11];
       BYTE FS_Type[8];
       BYTE boot_Code[448];
       WORD signature;
    } fdi;
    
    //###################Declaring variables#################
        int j,i,start,sector,bad_counter=0,sector_counter=0;
        char buf[512];
        profile_1();
        sector =0;
    
    //#################Reading From Floppy Disk #############
        if (absread (0, 1, sector,&fdi)!=0)
        {
        printf ("An Error Has Occurred!");
        exit(1);
           }
           printf("Read Seccessfully !\n");
    
    //################Printing The Infos on Consol##############
    
       printf("Floppy Disk Information: \n");
       printf("===========================\n");
       printf("Assembly Instruction to jump to Boot code: 0x%x\n",
          fdi.jumpCode);
       printf("OEM Name: %s\n",&fdi.oemName);
       printf("Bytes per sector: %d\n",fdi.bytes_Sector);
       printf("Sector per cluster: %d\n", fdi.sec_Cluster);
       printf("Size in sector for reserved area(Boot Sector): %d\n",
          fdi.size_Sector_Reserved);
       printf("Number of FATs(File Allocation Table): %d\n",
          fdi.fatCount);
       printf("Number of files for root directory: %d\n",
           fdi.Max_Root_Entry);
       printf("Number of Sectors in File System: %d\n",
          fdi.Total_Sector_FS);
       printf("Media Type\n(According to Microsoft,0xF8 == fixed disk and 0xF0 == Removable disk):0x%x\n", fdi.Media_Type);
       printf("Number of Sectors for each FAT: %d\n",
          fdi.sectors_per_fat);
       printf("Sectors per track: %d\n", fdi.sectors_per_track);
       printf("Number of head in storage device: %d\n",
          fdi.total_Head_Count);
       printf("BIOS INT13h Drive number: 0x%x\n", fdi.BIOS_13h_Drive_No);
       printf("Volume Serial Number: %d\n", fdi.vol_Serial_Number);
       printf("Volume label Name: %s\n", fdi.vol_Label_Name);
       printf("Boot Sector Signature: 0x%x\n", fdi.signature);
    
    
    
    
    //#######################FLP STATS#################
    
    for(i=0;i<=fdi.Total_Sector_FS;i++){
    if (absread (0, 1,i,&fdi)!=0) //&fdi is a  memory buffer that we will use to hold data
      { bad_counter++;}//number of bad sectors
     {
     sector_counter++;//number of used sectors
               }
    
    
    }
    //############declaring x and temp ###############
        unsigned long int x=fdi.bytes_Sector*fdi.Total_Sector_FS,y=fdi.bytes_Sector;
        unsigned long temp = (unsigned long)fdi.bytes_Sector * (unsigned long)fdi.Total_Sector_FS;
    //################################################
    
       printf("\n         ################## FLOPPY_STATS###############");
    
        printf("\n\nYour Floppy Disk Stats are as follows\n");
    
    
    printf("You have currently %ld Bytes on your Disk\n",x);
    
    printf("You have currently  %d Sectors of your disk space occupied\n",sector_counter);
    
    printf("You have currently %d bad sectors in YOur Floppy Disk\n",bad_counter);
    
    printf("Total used space on YOur Floppy disk is %d %% \n",(y*sector_counter)/100);
    
    printf("Total Free space on Your Floppy disk is %d %% \n",(x)-(y*sector_counter)/100);
    printf("\n\nX= %d %ul %i %li\n\n",x,x,x,x);
    printf("YOu have currently %ld Bytes on your disk",temp);
    
    //###################End of Cods#############################
    
    
    
    printf("\n\n                 Programed By Seyyed Hossein Hasan Pour\n");
    printf("                         December 12th 2007 ");
    printf("\n                  http://www.codeguru.com/forum ");
    
    
    
         getch();
         return 0;
        }
    
    //############This will pirnt the coder info ################
    
    void profile_1(void)
    {   int k;
        clrscr();
        gotoxy(27,5);
        printf("In the name of God\n");
       gotoxy(22,7);
        printf("A S.Hossein hasan pour Project\n\n");
        printf ("This program will show you the information stored on sector 0 of the Floppy Disk\n\n                        
    (FAT TABLE INFORMATION).\n\n\n              if you are ready press any key to continue ");
        for (k=0;k<=3;k++){
        //delay(50);
        printf(".");       }
        getch();
        }
    Last edited by Masterx; 12-22-2007 at 12:53 PM.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    first when i try to compile these codes i get negetive numbers while im supposed to get positive ones! i used different specifiers such as "&#37;ld, %d , %i, %u ,and etc .and all i knew in order to check if one could give me a close answer! but no luck ...
    the number i should get is sth like 1,475,365 or so , that according to my knowledge an unsigned long should give me that! or i can get such number with a "long" specifier ... any way when i try to use a long specifier i only get an irrelevant number of 136,465,321 or stuff like that !
    This seems to be the crux of your question. Instead of dumping a whole lot of unrelated code for us to look at, come up with the smallest and simplest program that demonstrates the problem. Remember to indent your code properly.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    بابلی ریکا Masterx's Avatar
    Join Date
    Nov 2007
    Location
    Somewhere nearby,Who Cares?
    Posts
    497
    there are two sessions ..
    in first session (Printing The Infos on Consol) this prog extract floppy disk geometry and FAT infos
    in second session (FLP _STATS) , bu using the given infos by the former session , the prog is going to calculate some extra information concerning Floppy disk such as : Total number of bytes
    total number of used /unused bytes , total number of bad sectors and etc ....

    so if you look closer you will definitely notice there is no unrelated stuff to be dumped!
    you need all of em to understand what i intended to do ...

    NOte that ... everything with first session is ok ..and there is no problem concerning FAT infos

    so all i need to knwo is why i get nonsense when i attempt to have a simple calculation out of these information that are also available !!and even using correct form of format specifiers !

    (in other words : why do i get a wrong result out of a simple calculation while the numbers are all clear ! ? !
    the number of sectors .. clusters and etc are all calculated and printed in advance (refer to the screenshot , you will see them ! ) ...
    why do i get a negative number when attempint to multiply two numbers such as 2880(number of sectors on a floppy disk ) and 512 (number of bytes in each sector ) / ?
    why ? i assumed i get a number of 14745632 or so ...by using a &#37;d specifier ! or even a %ld specifier ?)

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    so if you look closer you will definitely notice there is no unrelated stuff to be dumped!
    you need all of em to understand what i intended to do ...

    NOte that ... everything with first session is ok ..and there is no problem concerning FAT infos
    Of course, everything in a given program is related, at least by virtue of being part of the same program. That is beside the point. What I am saying here is that you should temporarily throw out everything that you know works, and concentrate on what does not work.

    so all i need to knwo is why i get nonsense when i attempt to have a simple calculation out of these information that are also available !!and even using correct form of format specifiers !
    To help you figure this out, people have to plow through code that you claim works, and figure out not only "why (you) get nonsense when (you) attempt to have a simple calculation out of these information that are also available", but also what the heck your code is about, which is quite unnecessary. To make things worse, Elysia would describe your code as "tomato soup" (though how on earth code can look like tomato soup beats me ).

    (refer to the screenshot , you will see them ! )
    What screenshot?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    بابلی ریکا Masterx's Avatar
    Join Date
    Nov 2007
    Location
    Somewhere nearby,Who Cares?
    Posts
    497
    tanx .. firs of all the reason why i coded this wasy is that .. as i mentioned above .. when i try to use some functions to give it a better look ..it just doesnt run ! thats one of the questions too!
    any way .. this kind of tomato sup or what ever is that clear to be understood even for the 8 years old kid ! http://kay.smiley.free.fr/images/3609.gif
    after all you can find the code in source-planet with Floppy info grabber ... and see if it works or not .. thats about it !

    and about screenshots
    may be its better to redirect you to the coe guru where i first started to solve the problem and cuz i couldnt figure how to work with solutions that those nice guys gave me ... im here
    ( im really ashamed of asking multiple times of the same question and bother some one )
    so i decided to give it a try here and see if you guys can give me a hand in this
    remmember that im just a rookie and i really dont know how to work with tools like debuggers and etc ...
    link

    tanx already

  6. #6
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    any way .. this kind of tomato sup or what ever is that clear to be understood even for the 8 years old kid !
    No, this kind of tomato soup is clearly written by someone with the mentality of an 8 year old kid. Get rid of that mentality and realise that formatting your code makes it more readable, and readable code attracts readers who may then help you.

    may be its better to redirect you to the coe guru where i first started to solve the problem and cuz i couldnt figure how to work with solutions that those nice guys gave me ... im here
    Paul McKenzie has made headway in helping you. Stick to one messageboard community for each question that you pose.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  7. #7
    بابلی ریکا Masterx's Avatar
    Join Date
    Nov 2007
    Location
    Somewhere nearby,Who Cares?
    Posts
    497
    Quote Originally Posted by laserlight View Post
    No, this kind of tomato soup is clearly written by someone with the mentality of an 8 year old kid. Get rid of that mentality and realise that formatting your code makes it more readable, and readable code attracts readers who may then help you.


    Paul McKenzie has made headway in helping you. Stick to one messageboard community for each question that you pose.
    It might be clearly written by a rookie whom you call a 8 year old guy ..but your attitude toward sb who needs help is definitely a sign of 8 year old kid who only wants to imply that i am the one who knows what to do and the rest must obey his narrow minded orders ! man i am a beginner what do you think of me ? knowing every single stages of programming ? ! if so do you think i needed your help ? ! for the sake of god change your mentality ,,change the way you think .. may be i wasnt that polite toward you so far .. but it is not the matter that makes you act this way !

    anyway ...
    this doesnt concern you if i post my questions in different boards ...
    if you can help i appreciate your kindness and generosity in helping me or any other guys
    if not please dont interfere !
    thats all
    Last edited by Masterx; 12-22-2007 at 01:13 PM.

  8. #8
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    It might be clearly written by a rookie whom you call a 8 year old guy ..but your attitude toward sb who needs help is definitely a sign of 8 year old kid who only wants to imply that i am the one who knows what to do and the rest must obey his narrow minded orders !
    I note that Martin O from Codeguru advised you to do the same. In this case, I really am the one who knows what to do. If you think my "orders" are narrow minded, go ahead. The vast majority of good programmers in the world disagree with you (at least where it concerns the formatting of C code and that of related languages).

    You can also stop insulting me now. I note that you pretty much told me that my skill at reading code is below the standard of 8 year old children.

    man i am a beginner what do you think of me ?
    I have nothing against beginners. If I did, I would not be making any effort to help them.

    this doesnt concern you if i post my questions in different boards ...
    1. You are likely to get multiple answers along different lines which may confuse you especially since you are new. Letting a single group of people coordinate their efforts to help you is more efficient and probably less confusing since they can correct each other and explain each other's points.

    2. You are likely to irritate people who frequent multiple forums (e.g., I am also a member of Codeguru).
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  9. #9
    بابلی ریکا Masterx's Avatar
    Join Date
    Nov 2007
    Location
    Somewhere nearby,Who Cares?
    Posts
    497
    i m not going to insult you .. you started first ...
    i tied my best and this is the code i have now ! when i am yelling i dont know how to do what you want and still you are sticking to tell me to do what you want ... please understand ..i really dont wana be rude .. i even didint mean it
    if i knew how to do or make it clearer i would do it at the first time martin o told me to !
    i REALLY DONT WANT TO BE IMPOLITE TOWARD YOU OR ANY BODY ELSE ... AND IM EXTEMLET SORRY FOR BEING RUDE TO YOU PLEASE FORGIVE ME FOR THAT CHILDISH BEHAVIOR !
    BUT THATS NOT ALL MY FAULT .. IF YOU COULD BE MORE FRIENDLIER IT WOULNDT END UP LIKE THIS
    any way ..i do really respect you ... thank you for your kind asnwer ... i really dont know why
    but please at least forgive me !
    Last edited by Masterx; 12-22-2007 at 01:48 PM.

  10. #10
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    but please at least forgive me !
    You're forgiven

    However, I am afraid I will not attempt to help you in this thread any more as I see it going nowhere. I suggest taking your advice from your existing thread at Codeguru, but perhaps someone here may decide to take this up and help you.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  11. #11
    بابلی ریکا Masterx's Avatar
    Join Date
    Nov 2007
    Location
    Somewhere nearby,Who Cares?
    Posts
    497
    I note that Martin O from Codeguru advised you to do the same. In this case, I really am the one who knows what to do. If you think my "orders" are narrow minded, go ahead. The vast majority of good programmers in the world disagree with you (at least where it concerns the formatting of C code and that of related languages).
    this is not what i really meant , you know when you told me "
    No, this kind of tomato soup is clearly written by someone with the mentality of an 8 year old kid."
    i estimated it as some kinda humiliation !" i just wanted to convey that the code is ok please try to understand it , it may be difficult to read but its not that hard by saying "this kind of tomato sup or what ever is that clear to be understood even for the 8 years old kid !"
    it all turned out to be a great misunderstanding , well i apologized you once for this kinda behavior ... and again im sorry !
    if you are really the one helps beginners like me i would be very thankful if you at least show mw how to make it clearer !

  12. #12
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by Masterx View Post
    Code:
    //version 0.1.0
    
    /* Using Structure to hold data+Floppy disk stats
    Original code :A Piece of COde that extracts floppy disk geometry information, 
    its  been writen in pure C and has been tested and ran seccessfully under TC 3 ...
    Added session:Floppy Disk Stat reader!, it is intended to show the floppy
    -disk information rather than its FAT info or floppy geometry!
     Cod3r :Seyyed HOssein hasn pour in NOvember 12th 2007
     www.PersianOs.org*/
    //##################Define Session######################
    typedef unsigned char BYTE;
    typedef short  int     WORD;
    typedef int          DWORD;
    //###################Main Session#######################
    void profile_1(void);
    //void FLOPPY_STATS(void);
    #include <stdio.h>
    #include <process.h>
    #include <string.h>
    #include <conio.h>
    #include <dos.h>
    
    /* Functions should start with no leading spaces or tabs */
    int main(void)
    {
    //###################Structure To hold data#############
    /* Structures are not meant to be declared inside functions.
    It should be OUTSIDE all functions, preferably at the beginning of your source file or in a header */
    struct Floppy_DISK_INFORMATION
    {
        BYTE jumpCode[3];
        BYTE oemName[8];
        WORD bytes_Sector;
        BYTE sec_Cluster;
        WORD size_Sector_Reserved;
        BYTE fatCount;
        WORD Max_Root_Entry;
        WORD Total_Sector_FS;
        BYTE Media_Type;
        WORD sectors_per_fat;
        WORD sectors_per_track;
        WORD total_Head_Count;
        DWORD no_Sectors_Before_Part;
        DWORD no_Sector_FS32;
        BYTE BIOS_13h_Drive_No;
        BYTE reserved;
        BYTE ext_Boot_Part_Signature;
        DWORD vol_Serial_Number;
        BYTE vol_Label_Name[11];
        BYTE FS_Type[8];
        BYTE boot_Code[448];
        WORD signature;
    } fdi;
    
    //###################Declaring variables#################
        /* Usually, it's best to keep things consistent. Don't use 3 spaces for indentation some 
            place and 4 spaces other places. Use one of those and stick with it. Myself, I prefer tabs. */
        int j,i,start,sector,bad_counter=0,sector_counter=0;
        char buf[512];
        profile_1();
        sector =0;
    
    //#################Reading From Floppy Disk #############
        /* All { and } should be on the same line. This tells us where a new block begins and 
            ends, so we can easily see what code belongs where.
    	Further, all code inside a block should be indented another level, to tell us that this 
    	code belongs to this block. */
        if (absread (0, 1, sector,&fdi)!=0)
        {
    	printf ("An Error Has Occurred!");
    	exit(1);
        }
        /* Keep indentation consistent! */
        printf("Read Seccessfully !\n");
    
    //################Printing The Infos on Consol##############
    
       printf("Floppy Disk Information: \n");
       printf("===========================\n");
       printf("Assembly Instruction to jump to Boot code: 0x%x\n",
       fdi.jumpCode); /* Keep indentation consistent! */
       printf("OEM Name: %s\n",&fdi.oemName);
       printf("Bytes per sector: %d\n",fdi.bytes_Sector);
       printf("Sector per cluster: %d\n", fdi.sec_Cluster);
       printf("Size in sector for reserved area(Boot Sector): %d\n",
       fdi.size_Sector_Reserved); /* Keep indentation consistent! */
       printf("Number of FATs(File Allocation Table): %d\n",
       fdi.fatCount);
       printf("Number of files for root directory: %d\n",
       fdi.Max_Root_Entry);
       printf("Number of Sectors in File System: %d\n",
       fdi.Total_Sector_FS);
       printf("Media Type\n(According to Microsoft,0xF8 == fixed disk and 0xF0 == Removable disk):0x%x\n", fdi.Media_Type);
       printf("Number of Sectors for each FAT: %d\n",
       fdi.sectors_per_fat);
       printf("Sectors per track: %d\n", fdi.sectors_per_track);
       printf("Number of head in storage device: %d\n",
       fdi.total_Head_Count);
       printf("BIOS INT13h Drive number: 0x%x\n", fdi.BIOS_13h_Drive_No);
       printf("Volume Serial Number: %d\n", fdi.vol_Serial_Number);
       printf("Volume label Name: %s\n", fdi.vol_Label_Name);
       printf("Boot Sector Signature: 0x%x\n", fdi.signature);
    
    
    
    
    //#######################FLP STATS#################
    
        /* Keep indentation consistent and every block must be indented one level and don't put
    	those { and } just about anywhere - place them where they SHOULD be. At the same 
    	level, at the same level as the block element (eg the for of the if, etc). */
        for(i=0;i<=fdi.Total_Sector_FS;i++){
    	if (absread (0, 1,i,&fdi)!=0) //&fdi is a  memory buffer that we will use to hold data
    	{ bad_counter++;}//number of bad sectors
    	{
    		sector_counter++;//number of used sectors
            }
        }
    //############declaring x and temp ###############
        unsigned long int x=fdi.bytes_Sector*fdi.Total_Sector_FS,y=fdi.bytes_Sector;
        unsigned long temp = (unsigned long)fdi.bytes_Sector * (unsigned long)fdi.Total_Sector_FS;
    //################################################
    
        printf("\n         ################## FLOPPY_STATS###############");
    
        printf("\n\nYour Floppy Disk Stats are as follows\n");
    
    
        printf("You have currently %ld Bytes on your Disk\n",x);
    
        printf("You have currently  %d Sectors of your disk space occupied\n",sector_counter);
    
        printf("You have currently %d bad sectors in YOur Floppy Disk\n",bad_counter);
    
        printf("Total used space on YOur Floppy disk is %d %% \n",(y*sector_counter)/100);
    
        printf("Total Free space on Your Floppy disk is %d %% \n",(x)-(y*sector_counter)/100);
        printf("\n\nX= %d %ul %i %li\n\n",x,x,x,x);
        printf("YOu have currently %ld Bytes on your disk",temp);
    
    //###################End of Cods#############################
    
    
    
        printf("\n\n                 Programed By Seyyed Hossein Hasan Pour\n");
        printf("                         December 12th 2007 ");
        printf("\n                  http://www.codeguru.com/forum ");
    
    
    
         getch();
         return 0;
    } /* Should be at the same level as the function! */
    
    //############This will pirnt the coder info ################
    
    void profile_1(void)
    { 
        /* It's preferred not to place lines at the same line as the { since it makes it more 
    	readable */
        int k;
        clrscr();
        gotoxy(27,5);
        printf("In the name of God\n");
        gotoxy(22,7);
        printf("A S.Hossein hasan pour Project\n\n");
        printf ("This program will show you the information stored on sector 0 of the Floppy Disk\n\n                        
    (FAT TABLE INFORMATION).\n\n\n              if you are ready press any key to continue ");
        for (k=0;k<=3;k++){
            //delay(50);
            printf(".");
        }
        getch();
    }
    Lots of changes. Read comments in green, observe changes in red.
    There's a reason we actually use indentation - because it's easier to read and it's easier to catch mistakes and because, frankly, I'd rather stare at a beautiful thing rather than an ugly thing for a lot of time. The nicer (the cleaner) the code looks, the better.

    And even after all this - there's a very simple lesson or rule you can remember instead of remembering all these tips and suggestions: write the code so that it is as easy as possible to read. Look at the code, take a look at what looks messy, change it. Make it into art.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  13. #13
    بابلی ریکا Masterx's Avatar
    Join Date
    Nov 2007
    Location
    Somewhere nearby,Who Cares?
    Posts
    497
    tanx a million Elysia ..i wont forget your tips
    again many tanx

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Errors including <windows.h>
    By jw232 in forum Windows Programming
    Replies: 4
    Last Post: 07-29-2008, 01:29 PM
  2. Confused with array size
    By desmond5 in forum C Programming
    Replies: 4
    Last Post: 12-04-2007, 05:14 PM
  3. failure to import external C libraries in C++ project
    By nocturna_gr in forum C++ Programming
    Replies: 3
    Last Post: 12-02-2007, 03:49 PM
  4. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 10:03 AM
  5. confused.. in selecting my line of deapth
    By jawwadalam in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 05-04-2003, 01:21 PM