M
M
Michael2016-02-07 11:52:26
go
Michael, 2016-02-07 11:52:26

How to write a large string to a variable using fmt.Scan ??

Hello, I have a piece of code

var args string
fmt.Scan(&args)

according to my logic, if I pass something like
-strict experimental -c:a aac -b:a 384k -ar 48000 -vcodec libx264 -pix_fmt yuv420p -preset veryslow -crf 16 -coder 1 -flags +loop -cmp chroma -partitions +parti4x4+partp8x8+partb8x8 -me_method hex - subq 6 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -b_strategy 1

he must keep it all there, and only
-strict
i.e. before the first space, what am I doing wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikita, 2016-02-07
@nextel

var s string
fmt.Scanf("%q", &s)

// Или

scanner := bufio.NewScanner(os.Stdin)
for scanner.Scan() {
    s := scanner.Text()
    fmt.Println(s)
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question