general protection exception

This is a discussion on general protection exception within the C Programming forums, part of the General Programming Boards category; void InputFile(); void ShowFile(); void justified(int k,char *argv[2]); int Valid, Verify,Counter,Row,Col,Num,width; char Contain[2],FileName[20],PCName[20], Item,EndKey; char OutFileName[20],CurrWord; int maxChar,maxWord,numChar,NumWord[100],k,c; FILE *fp; ...

  1. #1
    Registered User
    Join Date
    Aug 2002
    Posts
    2

    general protection exception

    void InputFile();
    void ShowFile();
    void justified(int k,char *argv[2]);

    int Valid, Verify,Counter,Row,Col,Num,width;
    char Contain[2],FileName[20],PCName[20], Item,EndKey;
    char OutFileName[20],CurrWord;
    int maxChar,maxWord,numChar,NumWord[100],k,c;



    FILE *fp;

    int main(int argc, char *argv[])
    { Valid = True;
    Verify = True;



    if(sscanf(argv[1],"%d",&k)== 1){

    printf("%d integer",k);
    }


    justified(k, argv);

    return 0;
    }

    *************************************

    message

    testing(1) 0x2427:0x4ffo processor fault

    using (turbo c 4.5)

    try F7 and reach

    if(sscanf(argv[1],"%d",&k)== 1){

    the whole thing stop.

    Please a beginner wish to learn

  2. #2
    Me want cookie! Monster's Avatar
    Join Date
    Dec 2001
    Posts
    680
    Read Salems advice in one of your previous posts....
    Check if you have any arguments before you use them.
    Code:
    int main(int argc, char *argv[])
    {
       printf("Program name = %s\n", argv[0]);
    
       if(argc == 1)
       {
          printf("No arguments passed\n");
          return -1;
       }
       return 0;
     }
    Hope this solves your problem.

    Cheers,
    Monster

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A general protection exception failure
    By louis_mine in forum C Programming
    Replies: 7
    Last Post: 11-25-2004, 02:22 AM
  2. Please assistance, general protection mistake
    By louis_mine in forum C++ Programming
    Replies: 3
    Last Post: 10-23-2004, 11:45 PM
  3. General Protection Exception
    By s9uare in forum C++ Programming
    Replies: 1
    Last Post: 11-02-2002, 10:46 AM
  4. General Protection?
    By drdroid in forum C++ Programming
    Replies: 1
    Last Post: 08-17-2002, 11:09 AM
  5. General protection exception??
    By jonesy in forum C Programming
    Replies: 6
    Last Post: 10-10-2001, 01:34 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21