Categories > Coding > C++ >

(Probably annoying by now) std::cout or std::printf?

TERIHAX

i say im gay as a joke 🙀

Posts: 2195

Threads: 102

Joined: Jul, 2020

Reputation: 30

Posted

title

 

i asked chatgpt and i still cant decide

 

srry if this is getting annoying

  • 0

Posts: 2

Threads: 0

Joined: Apr, 2023

Reputation: 0

Replied

printf stands for print format

or the og spell it printfffffffffffffeeee

It's on the stdio.h header which is the std input output lib for C and it's the standard way of printing to the console using C, but since C++ still maintains C backwards compatibility so it's still there and to make it easier to access so they include it in the std namespace i guess.

 

There's not much a difference to be considered should I use this or that. Pretty sure printf is just printing string to conout using placeholder formatting like

 

printf("Hello, %s", "Bob"); %s for string or %d for digit or int stuff so that the %s is replaced by "Bob" or whatever I can't explain really well icl

 

Doesn't matter afaik, I mean it doesn't affect your program stuff that much so yeah stop 😶

Comments

TERIHAX 30 Reputation

Commented

wdym by "stop" at the end, should i stop making these annoying c++ threads

  • 0

rilyn 0 Reputation

Commented

@TERIHAX No. don't afraid to ask questions, just stop asking question like this.

  • 0

TERIHAX 30 Reputation

Commented

@rilyn alright

  • 0

  • 0

0x90

dingleberry#2286

vip

Posts: 248

Threads: 26

Joined: Dec, 2020

Reputation: 27

Replied

std::cout is safe whilst printf may not be.

printf uses C runtime formatting which is notorious for causing some of the biggest bugs in history and causing billions of dollars in damage, outputting a string in printf is dangerous, whilst formatting them through a stream is not.

Comments

TERIHAX 30 Reputation

Commented

damn i didnt know it was that bad, also i rarely see you active anymore, what happened?

  • 0

SeizureSalad 36 Reputation

Commented

he has better things to do

  • 0

TERIHAX 30 Reputation

Commented

@SeizureSalad oh i can understand

  • 0

Added

@0x90 prob stupid question again, is using the system() function safe? like if i want to clear the console, like system("cls");

  • 0

0x90 27 Reputation

Commented

@TERIHAX System is used to invoke any shell command so the safety of it depends on how it's invoked.

 

Besides that though, system is a pretty slow function and using it to clear the screen is very slow, there are specific terminal codes dedicated to clearing the screen that are far better suited for it.

 

 

  • 0

  • 0

Posts: 1996

Threads: 198

Joined: Apr, 2021

Reputation: 13

Replied

std::cout cause yes

Comments

TERIHAX 30 Reputation

Commented

ok

 

/charesadasd

  • 0

  • 0

Random quote here...

Posts: 139

Threads: 28

Joined: Feb, 2021

Reputation: 3

Replied

I recommend you to use printf, as it is faster, and simpler to use.

printf(char *a, ...);

The argument a represents a pointer to the first character of a string that contains the format (example: "Text: %s\nNumber: %d\n");

The argument(s) ... represents either pointers to first character in string that represents `%s`, or just a number, or some other value...

Comments

luxiferrwoo -5 Reputation

Commented

no, and i dont think i have to explain why

  • 0

  • 0

Contribute to Express, an open-source ROBLOX exploit written fully in C.

Request

RequestJr

vip

Posts: 15

Threads: 1

Joined: Jul, 2023

Reputation: 6

Replied

std::cout 100%

Comments

TERIHAX 30 Reputation

Commented

wtf is with ur pfp

  • 0

Request 6 Reputation

Commented

shhh, science

  • 0

TERIHAX 30 Reputation

Commented

@Request understandable

  • 0

  • 0

silly billy 🍎🍎🍎🍎

yvneEnvy

<><><<>>><<>

Posts: 303

Threads: 47

Joined: Mar, 2023

Reputation: 3

Replied

STD = S*xualy trasmitted d- 

 

Printf = Pratical retar*dation international news torment function

  • 2

Users viewing this thread:

( Members: 0, Guests: 1, Total: 1 )