• 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.

strlen type

Goi

Diamond Member
Hi,
Can anyone tell me how to typecast strlen's size_t return type to int? I'm trying to use it to access an character array (basically a string) by doing like filename[strlent(filename) - 2] but cc keeps giving me a warning about size_t and int conversion.

Thanks!
 
I tried that, but it didn't work. I still get the following cc error:
cc: Info: csg.c, line 4201: In this statement, the return type for intrinsic "strlen" is being changed from "size_t" to "int". (intrinsicint)
filename[(int)strlen(filename) - 2] = NULL;
 
Thanks, that did the trick. I thought I had to include it, but then the program worked without it, other than the warning.
 
Back
Top