Wim
I must agree to that lol
BinaryByter
forced to agree by mihail...
BinaryByter
😂
BinaryByter
lol jk
itsmanjeet
Do you really mean C or just C++?
Sry for too late I mean only for C Yes some thing like .format
BinaryByter
however, C is pretty old
itsmanjeet
fmtlib is probably what you're searching for
I don't know about that Wait I will study for that
BinaryByter
you should use C++ instead
Mihail
In C just use sprintf
itsmanjeet
its not available in C
Shit Means only sprintf for c No other option
Mihail
What's wrong with it?
itsmanjeet
What's wrong with it?
Nothing much But like example if I am checking the file exist or not I have a function book file_exist(char* file_addr) For this I have variable as file name 🤔 Just want to know if better alternative exist But I can continue with it
BinaryByter
why QString?
BinaryByter
Are you expecting me to install a full 500meg library to use a string?
BinaryByter
Ummm...
BinaryByter
i'm speechless
BinaryByter
why ...
itsmanjeet
Just use C++ with std::filesystem
I use cpp only if it's necessary C give more information have things get done And also I like for doing hobby projects
BinaryByter
itsmanjeet
string also work
BinaryByter
string also work
don't look at his example
itsmanjeet
don't look at his example
It's with Qt framework
BinaryByter
It's with Qt framework
Qt everything except cute
BinaryByter
in C++17 you have std::filesystem
BinaryByter
use that please
itsmanjeet
Ok
BinaryByter
if you want to go with C, use the FILE structs and some posix functions
BinaryByter
if you want to use posix functions you might want to be careful on linux as it isnt fully posix compliant
BinaryByter
but it supports most of them
itsmanjeet
Oh Ok 🤔👍
BinaryByter
yea
BinaryByter
😂
Mihail
That does look more powerful compared to std::filesystem, but I'd still probably use std::filesystem unless it's a big project and/or C++17 isn't available
Daniele°
int file_exisits(char const* path){ FILE* fd = fopen(path,"r"); if( fd ){ fclose(fd); return 1; } return 0; }
BinaryByter
use bools as return here, please
Daniele°
use bools as return here, please
typedef enum{FALSE,TRUE} bool_t; bool_t file_exisits(char const* path){ FILE* fd = fopen(path,"r"); if( fd ){ fclose(fd); return TRUE; } return FALSE; }
BinaryByter
wtf are you doing?
Daniele°
wtf are you doing?
It's Classic method to create bool in C
Jussi
stdbool.h also works
Mihail
Jaun
Hey, I want to learn Android. Which language will be best kotlin or Java?
Jussi
Works
Jussi
t least in linux
BinaryByter
please quote the standard that says that path may not be a directory!
Mihail
Oh yeah gotta check that
Mihail
Because it check for it being an existing path or directory
BinaryByter
Oh yeah gotta check that
No, since you can have a FILE* of a path
Mihail
No, since you can have a FILE* of a path
Still the function is mean to check for a file existing so that's probably the intended behavior
Mihail
Depends tho
Jaun
dart
OK, someone have lecture of dart?
Mihail
a path is a file too
Yeah, so it depends on the intended behavior
Mihail
Which I don't know in this case
Mihail
C++17?
Also some old gcc versions did supports C++17, but didn't support std::filesystem yet
Jussi
There is a method to find out whether the handle is directory or file
Mihail
There is a method to find out whether the handle is directory or file
There's std::filesystem::is_regular_file, but it depends on what you mean by file
Mihail
Or you could just !std::filesystem::is_directory
Mihail
Again depends on the intended behavior
Jussi
https://en.cppreference.com/w/cpp/filesystem/status
Jussi
Yep
Jussi
The status gives all possible options to check afaik
Daniele°
Daniele°
Jussi
#define file_exists(N) (access(N, F_OK ) != -1)
Does this also work if you dont have permissions?
Daniele°
😂