Getting file extension in C

前端 未结 3 657
慢半拍i
慢半拍i 2020-12-01 03:30

How do you get a file extension (like .tiff) from a filename in C?

Thanks!

3条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-01 04:14

    You can use the strrchr function, which searches for the last occurrence of a character in a string, to find the final dot. From there, you can read off the rest of the string as the extension.

提交回复
热议问题