1. You provide a buffer into a function, the function will fill it and then same function returns same buffer, like strcpy().

2. You allocate a string memory inside a function, fill it with data and then return it. In this case you are responsible for freeing that memory somewhere later in code, when returned pointer is no longer needed.

In your case you are dealing with a 'string' object. It is a little more than just a pointer. You need to reserve these strings somewhere BEFORE the function call and then pass into a function the reference to the objects. And since you need a few values to return - I suggest an array of 'string' objects:[/color][code]void GetData (string a []){ // input into a[0], a[1], a[2], a[3]}...string MyStrings [4];GetData (MyStrings);...[/code]

Thank you for the advice.I simply put return input1, input2, input3..etc to show the fact I was trying to return more then one string at a time. I see how I should have worded that better.

After reading your advice I noticed that it will not accomplish what I want it to, I would like to create 54 .cxx files therefore I must check inside my function an integer.similar example from before: [code]For(int i = 1; i <=53; i++){.........GetData(i);......}[/code]

Now in the function Getdata, I must check to see value is being passed and return the appropriate amount of strings.For every integer of "i", the number of strings that must be passed from GetData varies from 1-7 strings.

Also I was unclear about your last idea. If you would please expound some more with an example code.

: return x, y, z;: : is the comma operator. I don't think it has a use, aside from maybe : some macro hackery, but it is part of the C++ standard and compilers : are obliged to support it.: : (A comma operator, not to be confused with the use of commas as : separators, is effectively the operator equivalent of a no-op. It : evaluates both operands and returns the right-hand one.):

[color=Blue]Thanks! Nice to know that, however, I still stand by my point. Compiler should not blindly implement comma operator everywhere, only in logical places for it. The [italic]return[/italic] statement is obviously the wrong place for it. Can you provide the example where it would be good to use in a [italic]return[/italic]?[/color]

: [color=Blue]Thanks! Nice to know that, however, I still stand by my : point. Compiler should not blindly implement comma operator : everywhere, only in logical places for it. The : [italic]return[/italic] statement is obviously the wrong place for : it. Can you provide the example where it would be good to use in a : [italic]return[/italic]?[/color]

Recognized coding standard such as MISRA-C bans the comma operator entirely. It is just another of those superfluous dumb things in the C language that only leeds to unreadable, possibly dangerous code.

For example, nobody can know what code like this will do:

if(x == str[i], i++)

The order of evaluation of the comma operator is undefined in the standard, and thus the above code can either work or lead to bad crashes.