Question: When I try to compare my database project to an existing database it displays the following error:

> 
> **The write operation failed. You must first acquire write access from DataSchemaModelController. E:\SRC SF\LIBRIDB\TePuna.scmp**
> 
> 
> 

Sql Server Version is 2012 Dev Edition

This happened after I reinstalled visual studio and sql server.

I have also installed SQL Server Data Tools 2012.

I searched with the same error on google but found nothing.

Any help is appreciated.

Answer: 
That's the signature of strtol():

```
long int strtol(const char *nptr, char **endptr, int base);

```

If `endptr` is not NULL, `strtol()` stores the address of the first invalid character in `*endptr`.
So you can simply compare `*endptr` to `nptr` afterwards and if it differs, `strtol()` has parsed the characters before `*endptr`.
Use the second parameter of strtol : it's a `char **`. It will be filled with the first invalid char: [take a look at this manpage](http://msdn.microsoft.com/en-us/library/w4z2wdyc%28v=vs.80%29.aspx).

Example:

```
#include <stdlib.h>
int main()
{
    char       *ptr = 0;
    const char *str = "1234abcd";

    printf("%d\n", strtol(str, &ptr, 10)); // -> 0
    printf("ptr: %c\n", *ptr); // -> 'a'
    while (*str && *str != *ptr)
    {
        printf("parsed: %c\n",  *str); // -> '1' '2' '3' & '4'
        ++str;
    }
    return 0;
}

```