#Problems with saving output to outputFile.

30 messages · Page 1 of 1 (latest)

steady citrus
#

So basically my program should read from the input file, edit the text according to given commands and save the output (without commands) to the outputFile.

There are few commands:
% remove - removes space characters from this line
% remove xyz - removes string from this line
% count - counts space characters in this line
% count xyz - counts strings in this line

Here is the example:

"inputFile"
Hello World !!!% remove
ABCABC% count A

"outputFile"
HelloWorld!!!
A: 2

as u can see only the result is saved to the output without % and command

And the problem with my project is that it does save things only before '%' character and I dont know why it doesnt save edited text.

I sent 2 pictures with my function that should both edit and save things.

Any help will be appreciated!

vernal oasisBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

#

@steady citrus

Screenshots!

Your message appears to contain screenshots but no code. Please send code and error messages in text instead of screenshots if applicable!

steady citrus
#

I used structures to store text, command, and argument

flint adder
#

first thing is, that Param struct makes no sense, just take them as 2 parameters :'D

#

it just adds a level of abstraction for no particular reason

steady citrus
flint adder
steady citrus
flint adder
steady citrus
#

i think its cpp now

#

is it?

flint adder
#

yeah

#

And what is the problem?

#

what is the output vs the expected

steady citrus
#

so the inside of my input file looked like this:

Hello, World% remove
aaa% count a

And the output file like this:

Hello, World
aaa

Expected output file should look like this:

Hello,World
a: 3

#

i think function void fixText might be a problem but idk whats wrong there

flint adder
#

For

Hello World !!!% remove
ABCABC% count A

It gave me

Hello World !!!
ABCABC

output

steady citrus
#

yea

#

and expected output should be
HelloWorld!!!
A: 2

flint adder
#

well obviously you don't write the commands so it makes sense, your commands seem to be faulty somewhere

steady citrus
#

i think my algorithm to delete for example space characters is correct but it somehow doesnt save

flint adder
steady citrus
steady citrus
#

@flint adder hey just wanted to say that i found the mistake, turned out that the commands were saved with the space at the beginning: " remove" instead of "remove" and thats why my function didnt work

#

!solved