Ok, so there is a place where the code is being converted into ASCII standard, and then being converted back I believe. I think I know how to do it, but I wanted to get help to make sure that when i am testing for bugs later that this isn't the mistake I made.

This is the original code. (data is a std::vector<char>)

var file = System.Text.Encoding.ASCII.GetString(data);

and this is what I made.

long unsigned int fileTempSize = data.size();
char *fileTemp = new char[fileTempSize];
for (int i = 0; i < data.size(); i++)
fileTemp[i] = data.at(i);
std::string file (fileTemp);

Is this valid? If it is then how would I convert it back to the ASCII standard? Is there an easier way that I can go about this? Ty :)

Why don't you skip the redundancy of placing this all inside another C-string and just loop through and append the vector's chars into the std::string.

string file_data;

for(size_t i = 0; i < data.size(); i++)
  file_data += data[i];

ok, the second half?

ok, the second half?

Which?

Sorry, I thought i mentioned it, after I convert this into ASCII, i need to convert it back (or do the opposite of what I did above)

Convert back? You never empty() the vector so you don't need to do place it back.

This is the original C# code, i am pretty much copying it into C++.

var file = System.Text.Encoding.ASCII.GetString(data);
                var lines = file.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
                var table = lines.Select(line => line.Split(new char[] { '\t' })).ToArray();
                foreach (var tableRow in table)
                {
                    if (tableRow.Length < 13)
                        continue;

                    if (string.IsNullOrEmpty(tableRow[(int)Columns.Name]))
                        continue;

                    if (string.IsNullOrEmpty(tableRow[(int)Columns.H1280]))
                        continue;

                    var x = int.Parse(tableRow[Xcol]);
                    var y = int.Parse(tableRow[Ycol]);
                    var w = int.Parse(tableRow[Wcol]);
                    var h = int.Parse(tableRow[Hcol]);

                    // Stuff that overlaps the centerline, stretches
                    if (y < oldHeight / 2 && (y + h) > oldHeight / 2)
                        h += higher;
                    // Stuff that is below the old centerline, moves down
                    else if (y > oldHeight / 2)
                        y += higher;
                    if (w == oldWidth)
                        w = newWidth;

                    tableRow[Xcol] = x.ToString();
                    tableRow[Ycol] = y.ToString();
                    tableRow[Wcol] = w.ToString();
                    tableRow[Hcol] = h.ToString();
                }
                var newLines = table.Select(tableRow => tableRow.Aggregate((output, col) => output + "\t" + col));
                var newText = newLines.Aggregate((output, line) => output + "\r\n" + line);
                var newBytes = System.Text.Encoding.ASCII.GetBytes(newText);
                UserFeedback.Info("Patched Gui Table #{0}", id);
                return newBytes;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.