So I have a few pieces of code that I want to implement into C++, and I think I understand what they are, but I want to check.

I have been using an array of char[] to mimic the byte[] idea. So keep that in mind when helping with these questions.

ReadUInt32() is a 4 byte integer, right? So technically I am reading 4 bytes into table.Type? Or does it do something else?

table.Type = reader.ReadUInt32();

I have no idea what the SelectMany function does along with the <=, these pieces are all part of a class.

inTables.SelectMany(table => table.Items)

Can (uint) be applied in C++?

No clue once again

var newLines = table.Select(tableRow => tableRow.Aggregate((output, col) => output + "\t" + col));

Thats all i have questions about now, I should be able to get few another 100 or 200 lines b4 I need help with these few things answered :) Ty for the help.

>>ReadUInt32() is a 4 byte integer, right? So technically I am reading 4 bytes into table.Type? Or does it do something else?
If you need integer types of fixed length, you should use stdint.h or cstdint (depending on what your compiler can support). Check this SO thread on the subject. For the second part, usually if a function is called "ReadUint32" it probably means that it is returning (reading) a value of type uint32 (32bits = 4bytes, unsigned integer).

>>Can (uint) be applied in C++?
Sure. Usually it is written as "unsigned int" (but most compilers will also accept uint as a shorthand).

For the rest I have absolutely no idea. In fact, you didn't mention from which language you are translating this code. In what programming language is the code you posted? I cannot tell and have no idea what the "=>" syntax is supposed to mean (maybe equivalent to "->" in C++, just as a guess).

For the rest I have absolutely no idea. In fact, you didn't mention from which language you are translating this code. In what programming language is the code you posted? I cannot tell and have no idea what the "=>" syntax is supposed to mean (maybe equivalent to "->" in C++, just as a guess).

The => symbols are found in lambda expressions in C#
(ex using a C# count operator int oddNumbers = numbers.Count(n => n % 2 == 1); ) n is basically an anonymous function.

All of these SelectMany() and Select() are LINQ (language integrated query) methods and you'd have to implement those by hand (doubtless that there are algorithms out there used in SQL connectors). You could probably get away with treating some of your data like a database and running similar operations from a SQL library.

Whoops I thought i had posted this in the C# section xD The answers were good anyways :P Going on the ReadUInt32 idea again.

So if i copy 4 bytes from my char array into the other char array thats the equivalent, right?

But then if I wanted to take the 4 bytes and store them as one unsigned integer how would I go about doing this?

If i use memorystreams (ifstream and ofstream) instead of a char array, I think it would be easier.

So assuming i define an ifstream and ofstream object, is the following valid?

unsigned int testInt;
inFileDrs.read(testInt, 4)
outFileDrs.write(testInt, 4)

Read the 4 bytes of an unsigned integer into the variable testInt, and then write out the same exact 4 bytes into outFileDrs. Both of these files are being used in binary mode. Is that valid? Ty :)

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.