+ 1
Why code isn't working?
10 Respostas
+ 2
Updated to create file and read so it runs here.
https://code.sololearn.com/cHPQeQFyuXns
+ 2
K
1010100(T)1001000(H)1000001(A)1001110(N)1001011(K)100000(Space)1011001(Y)1001111(O)1010101(U)
Xd
+ 1
This code can't run here as we don't get to have files so I assume you ran it elsewhere. Your biggest mistake is name. You don't allocate any storage for it, just a uninitialized pointer. When you read into it, you might be overwriting your code or other data variables. If you are lucky, you ran it on a system with memory protection so it crashes with an access violation error. Unlucky and your code could randomly erase your hard drive.
+ 1
Ur threatening xd
+ 1
Thn how to run it?
+ 1
U have any link for these type of file codes ,i want to understand it ,i m still lacking in many areas of this topic 😞
+ 1
Change line 9 to:
char a,name[100];
to allow 100 character names. It should run on your PC or phone with compile/IDE.
0
You have non-standard C++ includes so may only work with obsolete Turbo C++ on PC.
0
Btw fseek(f1,-1,1); for ?
0
That attempts to position to the character before the beginning of the file. Not sure what the result would be.
fseek(f1,-1,3);
Would be to read the last character as 3 picks the end of file.