Question: This has worked fine on some compilers... Is there a way of doing this were it will just work without it being a problem with different compilers on c++11 or c++14? 

```
#include <iostream>
#include <string>
#include <fstream>

using namespace std;

void save_file() {
    string file;
    ofstream os;
    cout << "Save As: ";
    getline(cin, file, '\n');
    os.open(file + ".dat");
    //rest of code
}

```

error: no viable conversion from 'basic\_string, std::allocator >' to 'const char \*'

So I google it, found some answers, or in this case, canswers (cancers), tried 

```
os.open(file.c_str() + ".dat");

```

error: invalid operands to binary expression ('const char \*' and 'const char \*')

Answer: 
I like using LINQ's [`OrderBy`](https://msdn.microsoft.com/en-us/library/vstudio/system.linq.enumerable.orderby(v=vs.100).aspx) and [`ThenBy`](https://msdn.microsoft.com/en-us/library/vstudio/bb534743(v=vs.100).aspx) to order collections of objects. You just pass in a selector function to use to order the collections. For example:

```
orderedObjs = objs.OrderByDescending(function(x) x.isPrimary).ThenBy(function(x) x.id).ToList()

```

This code orders a collection first by the `.isPrimary` boolean, then by the `id`. Finally, it immediately evaluates the query into a List and assigns it to some variable.

[Demo](https://dotnetfiddle.net/SFfUEH)
There's a similar [C# question](https://stackoverflow.com/questions/8866414/how-to-sort-2d-array-in-c-sharp) whose solution applies just as well to VB. In short, you can use [an overload](https://msdn.microsoft.com/en-us/library/85y6y2d3.aspx) of `Array.Sort` if you first split your 2D array into separate (1D) arrays:

```
Dim Primary() As String
Dim Data2() As String
// ...
Array.Sort(Primary,Data2)

```

This would reorder `Data2` according to the Y/N sort of `Primary`, after which point you could then recombine them into a 2D array.