• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

some help w/ this cpp prog??

cHeeZeFacTory

Golden Member
I want to write a prog ( in cpp) that reads in a text file w/ this:

a1908
b0980
r09809
...

to this:

a1908;b0980;r09809;...

I know it is simple, but i haven't programmed in a real long time. TIA!!
 
So you want to take a file consisting of entries, one per line, and have them instead be separated by a semicolon?

cat originalfile.txt | sed 's/\n/\;/g' > newfile.txt

No programming required.
 
fread or fget to the end of line, strip the newline and replace it with a semicolon, then continue the look until you hit EOF.

cat originalfile.txt | sed 's/\n/\;/g' > newfile.txt

No programming required.

Dumbass - he said he has to do it in C (well c++, but nothing in c++ says you can't use plain C).
 
Back
Top