Thread: Weird things happening!!!!!!

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    54

    Unhappy Weird things happening!!!!!!

    This is a bit difficult to explain, but here goes anyway

    I have a workspace with 2 .c files, 3 .h files and a .rc file

    every now and again i get errors about 2 functions that have always worked and i have not altered them in any way whatsoever either directly or indirectly

    because i cant track down the cause of these errors i remove the debug folder and rebuild the project. No errors, i make a small change to a file, 26 errors, i remove the change, 26 errors are still there ?????

    i am slowly loosing my sanity, can someone have a look at my code and aid me in fixing this weird happening please

    the functions in question are doFileSave & doFileOpen in the test1.c

    i have already reinstalled visual studio 6 in case it was a bug in the program, but still the same, i am running winXP

    thanx in advance

    korbitz

  2. #2
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Code:
    BOOL LoadTextFileToEdit(hEdit, pszFileName);
    BOOL SaveTextFileFromEdit(hEdit, pszFileName);
    //void DoFileOpen(hwnd);
    //void DoFileSave(hwnd);
    
    void splash(hInstance);
    
    HWND CreateNewMDIStatus(hMDIClient);
    LRESULT CALLBACK WndProc(hwnd, msg, wParam, lParam);
    LRESULT CALLBACK MDIStatusWndProc(hwnd, msg, wParam, lParam);
    BOOL SetUpMDIStatusWindowClass(hInstance);
    BOOL CALLBACK SplashDlgProc(hwnd, message, wParam, lParam);
    BOOL CALLBACK AboutDlgProc(hwnd, message, wParam, lParam);
    BOOL CALLBACK MenuDlgProc(hwnd, message, wParam, lParam);
    BOOL CALLBACK ToolDlgProc(hwnd, Message, wParam, lParam);
    BOOL CALLBACK WeightDlgProc(hwnd, message, wParam, lParam);
    BOOL CALLBACK SearchDlgProc(hwnd, message, wParam, lParam);
    BOOL CALLBACK EditDlgProc(hwnd, message, wParam, lParam);
    float convertTextToNum(char *text);
    void displayMenu(hwnd);
    void displayUserScreen(hwnd);
    void clearUserFields(hwnd);
    void displayUserControl(hwnd);
    See anything wrong here? Your prototypes are correct elsewhere so I assume this is a tiredness induced problem and I won't go into details. I didn't think this was valid either(but I may be wrong on this one):
    Code:
    static void logger(char path[MAXSTR], char test[MAXSTR]);
    Fix your prototyes in test.c and header files and see if the errors remain.

    Does anyome know why the compiler doesn't baulk on these invalid "prototypes"? The errors suggest that the compiler interprets them as being functions whose argument lists are not specified or take no arguments.

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    54


    many thanx, i dunno how i missed all them function prototypes, i must have looked at them loads of times

    but as i recall when i started this code, when i put the variable type and name i got errors which is why i changed them to just the name

    anyhow many thanx again


  4. #4
    Registered User
    Join Date
    Nov 2001
    Posts
    54

    Angry

    damn it, now all of a sudden one of the functions that worked before aint working too good, sometimes it works sometimes it crashes the system

    in one instance i ran the program and all worked well, so i exited the program, removed a commented line and ran the program again, IT NEVER WORKED

    i undid the removal of the uncommented line and then it worked

    Question: How stable is Visual Studio 6?

    the line number that is giving me problems is 989

    can someone have a look and see if they can spot anything wrong with my code as i am completely confused by all this

    thanx

    korbitz

  5. #5
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Line 989 is:
    Code:
    int temp = popStack(0); //get value from top of stack
    popstack calls removeStack():
    Code:
    static int removeStack(stk * stack){
    		stk * ptr;   
    		int temp;
    		
    		ptr = stack->next;   // Set temporary variable to the second item in the list
    		temp = ptr->id;   // Retrieve the ID number of the removed item
    		stack->next = ptr->next;   // Alter the list
    	
    		total ++;
    		free (ptr);   // Remove the item from memory
    		return temp;
    }
    The question I would ask is "what happens if stack->next is NULL?".

    A good idea is to learn to use the debugger. Set a breakpoint on the line that is causing you trouble and follow the code through to where it is crashing.

    >>Question: How stable is Visual Studio 6?<<

    Believe me, I've sworn at the compiler numerous times when I've had an unexplainable error. However, it has usually turned out to be a problem in my code. No compiler is perfect but most seem to be pretty good.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Suggestions for things to study
    By Mastadex in forum Windows Programming
    Replies: 5
    Last Post: 08-18-2008, 09:23 AM
  2. 2 things at once?
    By bradszy in forum C++ Programming
    Replies: 7
    Last Post: 02-20-2008, 01:19 PM
  3. free() doing weird things with file i/o
    By SgtMuffles in forum C Programming
    Replies: 2
    Last Post: 01-17-2007, 12:42 AM
  4. Funny things happening to values outside of function
    By drb2k2 in forum Windows Programming
    Replies: 2
    Last Post: 04-10-2003, 02:39 PM
  5. Help with these three things...
    By face_master in forum C++ Programming
    Replies: 2
    Last Post: 08-26-2001, 07:05 AM