Re: Rückgab e von mehrdimensionalem String in C++

Andreas Fett <[email protected]>
Newsgroups gmane.user-groups.linux.dresden
Message-ID <[email protected]>
Hallo,

On Sun, May 01, 2022 at 10:13:56PM +0200, Sebastian Reinhardt wrote:
> void READCSV::read_config_files(const std::string& csv_file_name)
> {
>     ifstream csv_in_file;
> 
>     string delimiter =
> ";";                                                      // Spaltentrenner
>     string elements[40][2]; // 2d string zum Speichern der Daten
> 
> ----------
> 
> Ich möchte nun die Variable "elements" zurückgeben.
> 
> Ein "return elements" wirft mir nat. nur den Fehler:

Bist Du Dir sicher, dass Du das in C++ programmieren willst?
Ich denke Python oder Perl, oder wegen mir Javascript oder PHP
wären deutlich besser geeignet.

Und ja, der C++ Compiler mag das nicht, wenn man den Return Typ als "void"
declariert und dann std::string[40][20] returned. Wobei das auch kein
"gute Idee" (TM) ist. Wenn es unbedingt C++ sein muss, nimm std::vector.

Aber siehe oben... nimm ne andere Programmiersprache.

Grüsse
Andreas
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEJ6Jq1qpfVQ9CLff4NMc/tuPtDEAFAmJu+X0ACgkQNMc/tuPt
DECzAQ//eocrMecXRo0LWgkJiOols4RFoYwzFnTIuaZMj0Q5+ZwQVlRukegLTdSN
Yvrt1v4qHoZToyh+UJ4pyHsP4+IVu2+soZnC7jsbSC7t1/lpMhfOe2kjRPCw9iww
mwH0osbL1BPd70p+ZaG+y3CwNmRvC0jNykQp7yshj3lNKGNrj5LF6Z59f62uYIMK
DlycN+RcqpnhEVAmtC9wmyuOz62pbUXju37z6GLqGgWkMEslA2nLRhT+aO935q5x
y8scDUvqek++78H1mdWf5AduTVCtJriJ1cfynYVZZMU4KCaxLK+kqD70Jn68WT23
ijeYqt3fplBmHpxiq1VbHUGM7DonHj31DBlaVF1MKgfXKYrIj3+o/3o3xUINmkUx
S32NYeIDGuGlET9+vo3QxKDOIbyUMN68NNaHJqxdR9LEC8UGGS0n8d/Kk+Qzh/LP
0zzRsucez5gmuMKK9Ts/Yvp53GkTKBr1rEVmsfwILttTUu3xltpNBFJvLH8VJEKB
9nTjjujhOvkSkPUf5Qs8nHJN7D4bbZ1Cb6id1LdzAIFqCLsLTv+ffe3olfrD2rDe
0EZ6rsbkUnanDWUb1CTU+OgnsYdsfTXtw2qTMC9w/kA2a+WLEZSmUVxA1IIvIwEX
nWikhinY03r3KWBiT829HkEZoU34NVnFIlfLZNmsUA6wE1OfYQg=
=cdLj
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.