Unsolved Write at the beginn of a File (.py)
-
-
-
Wehen i run your code, my .py scriptcode changed complete to only ONE Row.
-
@NotYourFan
the example is not checked, I don't have a +py file for that.Obviously you need to add a new line character at the end of each line.
if( i == 5) wstream << "test = 'TestFile.csv' " << "\n"; wstream << v.at(i) << "\n";;
-
This post is deleted! -
@J-Hilk
now it works the problem is when i changed the wstram it doesent override.i get " test = 'Hallo221.csv' test = 'Hallo1.csv' ...."
how i can override?
thx
-
@NotYourFan
What does "override" mean? Do you mean "overwrite" what is already inwstream
? Do you meanwstream.seek(0)
? -
yeah sry,
i mean "overwrite".
i always get " test = 'Hallo221.csv' test = 'Hallo1.csv' test = 'Hallo12321.csv' .....
but i want to get only "test = 'Hallo12321.csv' so i want to "overwrite" the line 5 and not add a new string
-
@NotYourFan
So did you try mywstream.seek(0)?
after the first write and before the second?
Or, depending on just what you intend by "overwrite", you may need towstream.resize(0)
.
Try with both"first-string-is-long"
,"second-is-short"
and then with"first-is-short"
,"second-string-is-long"
to see the difference betweenseek(0)
vsresize(0)
. -
You're doing fishy stuff, that may break at any point.
You should rethink what you're actually trying to do.for(int i(0); i < v.size(); i++){ if( i == 5) { wstream << "test = 'TestFile.csv' " << "\n"; if(v.at(i).contains("test = '")) continue; } wstream << v.at(i) << "\n"; }
-
@J.Hilk
PERFEKT !!!!!
THANK YOU SO MUTCH