#Can someone tell me what is wrong with my code, my data in json file was cut off like this..

16 messages · Page 1 of 1 (latest)

timid topaz
#

I'm learning about cJSON rigth now, and trying to add the input to a .json file. But just like in the photo, the value of the input is cut off when added to the file. What is the problem? Is it the cJSON function? or the input section?

leaden lanternBOT
#

Hi! I'd like to help, but I need more information to understand your issue. Here's what would help:

  1. Share your code - Please paste the C code you're working with (formatted in a code block with backticks)
  2. Show the error - Include any error messages or unexpected behavior you're seeing
  3. Clarify the problem - What exactly is "cut off"? Is it a parsing issue, file reading problem, or something else?
  4. Provide context - What's your JSON file structure? What are you trying to do?

Once you add these details, you'll likely get a quick answer! 👍

#

-# C @final fulcrum

topaz lichen
#

How is the book struct defined

final fulcrum
#

@timid topaz what is Book defined as

#

the only issue there would be with the struct, it seems to have it's strings set to be 4 long

timid topaz
final fulcrum
#

ah so it's taking the byte size of the pointer not array uhhh gimme like 10m to go find the right way to check size on that

#

wait

#

i just read more, found your issue, why do you use book.name in every strcspn :o

#

@timid topaz that seems like your issue

#

name is 4 long so it copies 4 from eh

#

each*

timid topaz
final fulcrum
#

all good

#

i mean it took 2 experienced devs hours to notice, sooooo