Hi all:
Some normal C string functions have equivalents defined in osapi.h. For example, os_strcpy is an alias for ets_strcpy. I thought maybe that was to avoid having to use libc, but other functions, like os_strcat, are direct aliases for libc functions. Why the difference?
I ask because I want to use other string.h functions, like strlcat. They seem to work fine, but I'm wondering if it will cause problems.
Thanks.
String functions defined in osapi.h
Re: String functions defined in osapi.h
Postby pratik » Fri Jul 08, 2016 1:44 pm
Hello,
Any string functions use pointers and the ESP8266 has hardware to access word aligned memory locations. That is why it is safer to use the array manipulation functions provided by Espressif rather than directly cast pointers.
If the other functions you tried work, you may continue to use them. But there is a possibility that they may fail with exceptions sometimes. But if your compiler takes care of boundary alignment then there should be no issue.
Any string functions use pointers and the ESP8266 has hardware to access word aligned memory locations. That is why it is safer to use the array manipulation functions provided by Espressif rather than directly cast pointers.
If the other functions you tried work, you may continue to use them. But there is a possibility that they may fail with exceptions sometimes. But if your compiler takes care of boundary alignment then there should be no issue.
Who is online
Users browsing this forum: No registered users and 284 guests
Login
Newbies Start Here
Are you new to ESP8266?
Unsure what to do?
Dunno where to start?
Start right here!
Latest SDK
Documentation
Complete listing of the official ESP8266 related documentation release by ESPRESSIF!
Must read here!
- All times are UTC+08:00
- Top
- Delete all board cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. We are the manufacturer of ESP8266EX.