Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
你好,制作一个读取文本文件的小程序,然后创建一个输出文本文件,其中行号前缀在字符串前面。
由于使用 fgets 调用输入文件。我想在将其输出到纺织品之前更改它存储的字符串数组。
示例原始文件
Hello How Are you? good.
输出文件
1 Hello 2 How Are you? 3 4 good.
我希望这个程序采取的下一步是不打印空行。但就我最初提出的问题而言,这就像一个魅力。感谢@optimist 的洞察力。
while( ( fgets( b, MAX, src ) ) != NULL ) { linecount++; fprintf( dst, "%d: ", linecount ); fputs( b, dst ); }
我有时会出现在我看来很长的网址,例如:
"https://www.google.de/#hl=de&sclient=psy-ab&q=break+long+url+css&oq=break+long+url+&gs_l=serp.1.1.0i30l4.3822.3822.0.5634.1.1.0.0.0.0.85.85.1.1.0.