15,895,011 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Lones (Top 3 by date)
Lones
22-Dec-21 15:50pm
View
also changing my codes to this
fseek(file, 0, SEEK_END);
long count = ftell(file);
fseek(file, 0, SEEK_SET);
solved 00 00 00 problem but now decompressing fails
Message: hello world this is a trial
Compressed version: E8 32 9B FD 06 DD DF 72 36 19 44 47 A7 E7 A0 F4 1C 14 06 D1 E5 E9 30
Decompressed version: hello world this is a tria
Compression crushed!
decompression doesn't take last letter
Lones
22-Dec-21 15:32pm
View
Thanks a lot for answer, sorry but what did you mean by 1) one creating message with malloc
char Message[count] = (long*)malloc(count *sizeof(long));
I tried like this but compiler says "error: variable-sized object may not be initialized" however even if it would accept I think this would be already pointless because you said "if count is larger than maximum stack size, you can corrupt other variables already on the stack" I couldn't figure out how to create array Message with malloc also with limit of count,
sorry my questions might be bad or ridiculous, I'm very new to programming (just been 2 months) and only used C and C++ till now
Lones
22-Dec-21 13:20pm
View
strlen(Message) returns 27 which is equal to character numbers in .txt file
Message[count]='\0'; I added this because compressing was crushing before it, it was adding some U*? strange chars at the end of file (I assume program was not seeing end of the file)