• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 303
  • Last Modified:

VC++ dll error: not all control paths return a value

I am getting an error that says "not all control paths
return a value."

char *Getinfo(char *name, int length, int number, char *string)
{
    char* temp = new char[100];
    name = temp;
    int flag = 0;
    if (flag == 0)
     {
        return temp;
     }
}

I'm not sure if i'm returning the character string correctly

thanks

   
0
pesst
Asked:
pesst
  • 2
  • 2
1 Solution
 
jkrCommented:
Simply change the code to read

char *Getinfo(char *name, int length, int number, char *string)
{
    char* temp = new char[100];
    name = temp;
    int flag = 0;
    if (flag == 0)
     {
        return temp;
     }

// the missing control path is here ...
return ( <whatever is appropriate in this case...>);
}
0
 
jkrCommented:
BTW:

    int flag = 0;
    if (flag == 0)  // this is always TRUE!!
     {
        return temp;
     }

I assume there should be some more code between the initialization of 'flag' and the 'if' clause...
0
 
pesstAuthor Commented:
Stupid mistake had me stuck for an hour

thanks!
0
 
pesstAuthor Commented:
i know i just didn't want to post my real code
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now