Home
Blogs
Questions
Jobs
Monetize

Home

About Us

Blogs

Questions

Jobs

Monetize

Post Job

banner

Questions about garbage

Read more about garbage

python (12.9k questions)

javascript (9.2k questions)

reactjs (4.7k questions)

java (4.2k questions)

java (4.2k questions)

c# (3.5k questions)

c# (3.5k questions)

html (3.3k questions)

Questions - garbage

Malloc or Calloc return unexpected values in string

I am trying to create a dynamic memory allocation string so which returns a string removing all vowels. In the beginning, some of the strings work correctly but suddenly some of them returns with an ...
test-img

Raihan_Alam

c

string

malloc

dynamic-memory-allocation

garbage

Votes: 0

Answers: 1

Latest Answer

You don't null terminate the buffer. Therefore strcpy wil just copy the contents of buf until a null character is encountered which is undefind behaviour. Add this right after the forloop: buf[j] = 0;...
test-img

Jabberwocky

Weird characters appear at the end of file when encrypting it

I never thought I would have to turn to SO to solve this. Alright so for more insight I am making my own encryption program. I'm not trying to make it good or anything it's just a personal project. Wh...
test-img

Mr Fly

c++

file

garbage

Votes: 0

Answers: 1

Latest Answer

The problem is that you are measuring the length of the file in bytes, which, for text files, is not the same as the length in characters. But you are then reading it as characters, so you end up rea...
test-img

Chris Dodd

Posts

Questions

Blogs

Jobs

The ultimate platform for coders and IT specialists

About

  • Company
  • Support

  • Platform

  • Terms & Conditions
  • Privacy statement
  • Cookie policy
  • Cookie option
  • OnlyCoders © 2025  |  All rights reserved