elikor gh
Good morning guys
Is anybody here from Cuba?
Kindly PM pls.
klimi
Ибраги́м
https://www.reddit.com/r/cpp/comments/bwwe58/c_performance_benchmarks_release_12/
klimi
Welcome
Amol
Hii sir
Mat
Anonymous
how to read a integer from file?
Anonymous
fscanf isn't working
Jussi
Is it presented as text or in binary?
Anonymous
text
Jussi
Read text into buffer and use sscanf
DaVlad 🇸🇰
fscanf should work too
Anonymous
the number stored is one but it prints 28 everytime i run it
Anonymous
Hi
Anonymous
Jussi
Anonymous
yes
Anonymous
DaVlad 🇸🇰
Anonymous
wait
Jussi
It might be that you are opening the file in binary read mode
Jussi
Erm
Jussi
Actually you are not calling fopen at all
DaVlad 🇸🇰
I don't see you are opening file
DaVlad 🇸🇰
Anonymous
so how to fix it ?
Jussi
...
Jussi
I think we gave some hints already :-)
Anonymous
ok letme try
Anonymous
😅
thank yiu
Anonymous
you*
Jussi
FILE* file = fopen( ... );
DaVlad 🇸🇰
you also need to check if the file was opened actually
DaVlad 🇸🇰
and only after that you can read from it
Anonymous
it is working fine now
void account::read_data(){
FILE *file;
file = fopen("C:\\cfiles\\count.txt","r");
if(!file){
cout << "error\n";
}
int ch;
fscanf(file,"%d",&ch);
cout << ch << "\n";
ch = ch+1;
cout << ch << "\n";
fputc(ch,file);
fclose(file);
Anonymous
thank you :)
Anonymous
i forgot i had changed the location of file🤦🏻♂️
DaVlad 🇸🇰
Anonymous
Jussi
Why do you use C fopen if you are using C++?
Anonymous
cause i don't know how to read int from c++ style files😅
Anonymous
fstream filee("c:\\cfiles\\bankrecord.txt",ios::in|ios::out|ios::app);
if(!filee.is_open()){
cout << "error in opening file\n";
}
filee << ch << " Record\n";
filee << "Account holder name: " << name <<"\n";
filee << "Account number: " << acno <<"\n";
filee << "Amount: " << amount << "\n";
filee << "End\n";
cout << "File saved succesfully\n";
filee.close();
YOU MEAN THIS ?
Jussi
Yeah but reading from there using streams
Anonymous
ok will try
Anonymous
😁
Jussi
nah no need :D
Jussi
I was just thinking why you mix those
Anonymous
why/
Anonymous
all functions fputc fgetc take pointer to files as argument
Jussi
doesn't look clean ;)
Anonymous
Jussi
In C++ you could do
int a;
ifstream ifs("file.txt");
ifs >> a;
to read the integer to a
Anonymous
yeah worked will change the code
thanks 😁
Jussi
no problem :)
Anonymous
i want to read from file delete old data and save new which mode should i choose
Anonymous
as trunc will format it first and then store
Anonymous
and app will add it to last
DaVlad 🇸🇰
Anonymous
yup
Anonymous
😊
Anonymous
/kick
Dima
Lol
Anonymous
#ot
Dima
why you have to click these buttons
Anonymous
Cut
Hi! Nice to meet you all! I'm a student in Web&Cloud Architecutre
Dima
welcome
Anonymous
Welcome cut
Cut
It's not to take advantage of your skills immediately.... buuuuut there is anyone skilled with the Azure Storage queues to use, however, locally and not in the cloud?
I think I Have to use the Storage Emulator...
Cut
Just for testing the queues
DaVlad 🇸🇰
DaVlad 🇸🇰
Just like for S3
Cut
nono, there is an application pre-installed on W10 from the CMD
Cut
it's called Microsoft Storage Emulator
DaVlad 🇸🇰
Oh
DaVlad 🇸🇰
Even better
Cut
yes but the documentation is... haahha
Dima
Lol.