Results 1 to 3 of 3

Thread: Access Violation? I'm not seeing why.

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800

    Access Violation? I'm not seeing why.

    Code:
    char FileName[100];
    		char ShortFileName[100];
    		char todo[200];
    		GetWindowText(ghWnd_File, FileName, 100);
    		if(GetShortPathName(FileName, ShortFileName, 100) !=0) {
    			strcat(todo, "open ");
    			strcat(todo,  ShortFileName);
    			strcat(todo, " type mpegvideo Alias mpeg");
    			mciSendString (todo, 0, 0, 0);
    		}
    this gives me an access violation why!

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    I think it's because todo is an array rather than a pointer...a subtle but annoying difference I don't usually use strcat anyway, I much prefer sprintf
    Code:
    char FileName[100];
    char ShortFileName[100];
    char todo[200];
    GetWindowText(ghWnd_File, FileName, 100);
    if(GetShortPathName(FileName, ShortFileName, 100) !=0) {
    	sprintf(todo, "open %s type mpegvideo Alias mpeg", ShortFileName);
    	mciSendString (todo, 0, 0, 0);
    }
    I hope that works...
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    Thanks again

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width