Skip to main content

Questions tagged [c-string]

A "C string" is an array of characters that ends with a 0 (null character) byte. The array, not any pointer, is the string.

Filter by
Sorted by
Tagged with
1 vote
1 answer
1k views

I have to handle a String coming in over UART containing a bunch of information, part of it is a MAC-address that I get by using String.substring(a, b) returning a 12-char String representing a mac-...
Harald Lesan's user avatar
1 vote
2 answers
493 views

I am trying to write my own Arduino library and I would like to make it useful not just for ESP32/ESP8266 boards but also with Arduino boards. I have created my header file like this test.cpp #...
Mark Estrada's user avatar
0 votes
2 answers
856 views

I am newbie in Arduino and writing a program where I want to control the flow by using Serial monitor input (PI controller). I've read that using String() although easier it is slower than using char. ...
Ognyan Petkov's user avatar
0 votes
1 answer
196 views

I want to extract the file name MyFile.txt out of a path which is stored in a string "C:\\MyDirectory\\MyFile.txt"; I found a simple c code which does the job. string filename = "C:\\...
Santhosh Dhaipule Chandrakanth's user avatar
12 votes
6 answers
5k views

I've been reading a lot over the years why we should not use the notorious String class and how heap fragmentation is bad practice and not professional and we should never use it in our programs or we'...
Nino's user avatar
  • 411
0 votes
1 answer
1k views

I'm getting a bit tripped up on const char pointers lately. I'm getting a message from a server that comes through as either a c style string, a standard library string, or a WString: I'm sending down ...
Chris Schmitz's user avatar
1 vote
2 answers
1k views

I have following function for my Arduino: String readLine() { String received = ""; char ch; while (myFile.available()) { ch = myFile.read(); if (ch == '\n' or ch == '\r') { ...
sharkyenergy's user avatar
0 votes
1 answer
81 views

For the below code snippet const char* fr_fbdb(char tag[30]) // fn for retrieving data { char full_path[120]; const char *_dt ; strcpy(full_path , base_path); strcat(full_path , tag); ...
Somasundharam Sampath's user avatar
-1 votes
1 answer
1k views

I have a mobile app (done using MIT App Inventor) storing some values to a Firebase database. App inventor stores all the values as strings (i.e. with quotes, and strings have quotes enclosed within ...
Somasundharam Sampath's user avatar
1 vote
2 answers
3k views

I'm trying to compare a char array that I'm assembling to a string and I'm having trouble comparing the strings. I'm getting the data for the char array as a set of bytes and I'm compiling it into a ...
Chris Schmitz's user avatar
0 votes
1 answer
450 views

I don't understand why the formatted string is displaying ?? instead of float values. My code: #include <Arduino.h> #include <Wire.h> #include "SparkFunCCS811.h" #include <...
Zaffresky's user avatar
  • 183
1 vote
2 answers
11k views

I have a string that looks like this "10.00,20.00,-50.00," in which these are angle values and they have 2 decimals and can be negative. I want to separate them into 3 separate floats. Here ...
DragonflyRobotics's user avatar
1 vote
0 answers
602 views

I know this is Arduino Forum but I think this question is related to programming, I am using ESP8266 for the project. I need to convert the string incoming on the serial through UART lines and ...
Naren2312's user avatar
0 votes
1 answer
70 views

I am trying to write a function to store the date and time data from an RTC module. I have used char arrays to implement the function. I get "declaration of 'varDay' as array of references" ...
Zaffresky's user avatar
  • 183
0 votes
2 answers
628 views

I know it's bad to use Strings due to the memory problems that can occur. I've tried to remove all instances of strings from my code. But I'm not sure about this line: http.getString().toCharArray(...
David Klempfner's user avatar
0 votes
3 answers
3k views

I am running the following code on my ESP8266 (AI-Thinker ESP8266MOD). I send an HTTP GET request and a pin is set to high for a 1/2 second. However, after some time (sometimes 1hr, 2hrs, 12hrs, ...
David Klempfner's user avatar
0 votes
1 answer
3k views

I am trying to publish json object into string with following snippet JSONVar data; data["chipid"] = chipId; data["co2_equivalent"] = co2_equivalent.c_str(); data["tvoc"] = tvoc.c_str(); data["...
rp346's user avatar
  • 113
1 vote
1 answer
308 views

I made a sketch like this: void setup() { // put your setup code here, to run once: Serial.begin(9600); char str1[64] = "test with spaces"; char str2[32] = "test with spaces"; Serial....
MrCabana's user avatar
0 votes
1 answer
728 views

I am still not sure what should be the exact Title for this question, because I don't know where the problem is. I am using #include <MQTTClient.h> mqtt library to subscribe on a topic. This ...
Anum Sheraz's user avatar
0 votes
1 answer
3k views

I am working on a project where I need to split incoming data from serial (time to be exact, so aa:bb:cc) and need to split it into aa then bb and cc, ideally into an array. I know I could use ...
kuskus's user avatar
  • 35
2 votes
1 answer
2k views

Libraries NTPClient Board Olimex ESP32-POE board Behaviour I have written a code that connects the board to a local NTP Server (which is an embedded board). I tried assigning the IP Address of the ...
Shan-Desai's user avatar
3 votes
2 answers
23k views

I'm reading a RFID Card from RC522 and send the data to my computer. My problem is the conversion of byte[] to String or std::string. #define SIZE_BUFFER 18 #define MAX_SIZE_BLOCK 16 byte ...
Augusto's user avatar
  • 131
10 votes
5 answers
69k views

I wander what is the best option for formatting strings in Arduino for output. I mean what's a preferable way in the point of view of performance, memory usage – things like that. I see, people ...
zhekaus's user avatar
  • 459
1 vote
1 answer
4k views

I have the following Arduino code for configuring a wifi connection through a simple webpage: I declare char* ssid;. Later I read a value from a SPIFFS config file where q_ssid is declared as a ...
Tim Spanoudakis's user avatar
0 votes
2 answers
3k views

I want to check the water level and have an SMS sent via a GSM module. Reed switches are connected to four Arduino analog inputs. I am unable to add a string and tank level (TKLVL) in program. The ...
Nikhil P's user avatar
0 votes
2 answers
5k views

I'm running the following Sketch on my Arduino Uno: const boolean verbose = true; void debug(const char *s){ if(verbose){ char buf[8 + sizeof(s)] = "[DEBUG] "; strcat(buf, s); ...
tr01's user avatar
  • 117
0 votes
1 answer
2k views

I'm running a sketch whith a quite big, constant three dimensional char array (or simply, a table of strings). As this takes lots of RAM I'd like to store it in programm memory in order to keep the ...
tr01's user avatar
  • 117
17 votes
1 answer
160k views

I'm looking to convert an int value to a char array. currently I've found the following will return [number] int num = [number] str = String(num); str.toCharArray(cstr,16); Serial.println(cstr); ...
ATE-ENGE's user avatar
  • 941