search
HomeComputer TutorialsComputer KnowledgeUrgent help: Write a basic C language data compression program!

Urgent help: Write a basic C language data compression program!

Programming in C language: a simple data compression program urgent!

s;,'i ;c,i);

b[j]=-c;

for(k=0;k

while(a[i]!='\%d\t"

b[j]=c ;

b[j 1]=a[i]-'0';6'}

return c,k=0;

}

int len(char a[])

{ int i=0;,'9',c;)

{

if(a[i 1]==a[i])

{

c=c1(a,i);stdio;9'k )

{b[j 1]=a[i]-',j=0;2','9'

while(a[i 1]!=a[i])

{c ;};9'6'

int i=0;,'\0')

i ;

return i;

}

main()

{int b[100].h"

int c1(char a[],int i)

{int c=1;}

return c;,','

while(a[i];,','6'!=','0','

}

s=len(b);

for(j=0;j

i ;j ;}

}

i =c;

char a[100]={'

while(a[i 1]==a[i])

{c ;,'8','

}

int c2(char a[],int i)

{int c=0;,'3'7','5'1'5'2'#include "i ;

i ;j ;

}

else

{ c=c2(a;,'0'5's;j )

printf("

Which command can be used to compress database capacity

After the database is used for a period of time, there will often be too much free space in the database due to data deletion. In this case, it is necessary to reduce the disk space allocated to the database file and transaction log file to avoid wasting disk space. When there is no data in the database, you can modify the database file attributes to directly change its occupied space. However, when there is data in the database, doing so will destroy the data in the database, so compression is needed to reduce the database space. You can select the "Auto shrink" option in the database property options to let the system automatically compress the database, or you can compress it manually. There are two ways to manually compress the database:

1. Use Enterprise Manager to compress the database

In Enterprise Manager, right-click on the database to be compressed and select the "Shrink Database" option from "All Tasks" in the shortcut menu

, Use Transact-SQL command to compress the database

You can use the DBCC SHRINKDATABASE and DBCC SHRINKFILE commands to compress the database. The DBCC SHRINKDATABASE command compresses the database, and the DBCC SHRINKFILE command compresses the files specified in the database.

(1) DBCC SHRINKDATABASE

The DBCC SHRINKDATABASE command syntax is as follows:

DBCC SHRINKDATABASE (database_name [, target_percent]

[, {NOTRUNCATE | TRUNCATEONLY}] )

Each parameter is explained as follows:

target_percent specifies what percentage of the database size the unused space will account for after the database is compressed. If the specified percentage is too large and exceeds the proportion of unused space before compression, the database will not be compressed. And the compressed database cannot be smaller than the initial capacity of the database.

NOTRUECATE

Keep the remaining space after the database is reduced in the database and will not return it to the operating system. If you do not select this option, the remaining space is returned to the operating system.

TRUNCATEONLY

Return the remaining space after the database is reduced to the operating system. When you use this command, SQL Server shrinks the file area to the last file allocation, but does not move any data files. When this is selected, the target_percent option has no effect.

The unused space of the compressed database mytest is 20% of the database size.

dbcc shrinkdatabase (mytest, 20)

The running results are as follows:

DBCC execution completed. If DBCC printed error messages, contact your system administrator.

(2) DBCC SHRINKFILE

The DBCC SHRINKFILE command compresses files in the current database. Its syntax is as follows:

DBCC SHRINKFILE ( {file_name | file_id }

{ [, target_size] |

[, {EMPTYFILE | NOTRUNCATE | TRUNCATEONLY}] } )

Each parameter is explained as follows:

file_id

Specify the identification number (ID) of the file to be compressed. The file ID number can be obtained through the FILE_ID() function or the Sp_helpdb system stored procedure described earlier in this chapter.

target_size

Specify the compressed size of the file. Measured in MB. If you do not specify this option, SQL Server will shrink the file as much as possible.

EMPTYFILE

Indicates that this file is no longer used and all data in this file will be moved to other files in the same file group. After executing the command with this parameter, the file can be deleted using the ALTER DATABASE command.

The remaining parameters NOTRUNCATE and TRUNCATEONLY have the same meaning as in the DBCC SHRINKDATABASE command.

Example: Compress the size of the database file mydb_data2 in the database mydb to 1MB. use mydb dbcc shrinkfile (mydb_data2, 1)

The above is the detailed content of Urgent help: Write a basic C language data compression program!. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:Excel办公网. If there is any infringement, please contact admin@php.cn delete
Zoho Mail Login/Sign-up | Zoho Mail App Download - MiniToolZoho Mail Login/Sign-up | Zoho Mail App Download - MiniToolApr 23, 2025 am 12:51 AM

This post mainly introduces Zoho Mail. Learn how to sign up for Zoho Mail and log into your Zoho Mail account to use this email service to view and manage your personal or business emails.

How to Show or Hide Formulas in Microsoft Excel? - MiniToolHow to Show or Hide Formulas in Microsoft Excel? - MiniToolApr 23, 2025 am 12:50 AM

Want to show formulas in Excel? Want to hide formulas in Excel? It is not difficult to do these jobs. php.cn Software collects some useful methods and shows them in this post. In addition, if you want to recover your lost Excel files, you can try php

Now Google One VPN Can Be Downloaded to Windows and Mac for Use - MiniToolNow Google One VPN Can Be Downloaded to Windows and Mac for Use - MiniToolApr 23, 2025 am 12:49 AM

Does Google provide a free VPN? What is Google One VPN? Do you get VPN with Google One? In this post, php.cn will show you information about this VPN service. Besides, you can download Google One VPN for Desktop (Windows & macOS) to access the in

How to Fix 'internal hard drive keeps disconnecting Windows 10'?How to Fix 'internal hard drive keeps disconnecting Windows 10'?Apr 23, 2025 am 12:48 AM

Are you struggling with the “internal hard drive keeps disconnecting Windows 10” issue? There are many possible reasons for this related issue and you can read this post on php.cn Website for detailed troubleshooting measures and figure out its trigg

How to Fix FIFA 22 Crashing on Windows 10/11? - MiniToolHow to Fix FIFA 22 Crashing on Windows 10/11? - MiniToolApr 23, 2025 am 12:47 AM

FIFA 22/21 is a popular game that there is no football fans can resist it. However, you will be stopped from enjoying the game due to some reasons. One of the most frequent issues that you might meet is FIFA 22/21 crashing on PC. If your FIFA 22 keep

How to Fix Hulu Missing Episodes? Try These Fixes! - MiniToolHow to Fix Hulu Missing Episodes? Try These Fixes! - MiniToolApr 23, 2025 am 12:46 AM

Some of you find that Hulu won’t play certain shows when intending to watch some videos on it. To address Hulu missing episodes, we have sorted out some potential reasons and feasible solutions for you on php.cn Website. If you are also troubled by i

How to Download and Install Google Drive for Windows - MiniToolHow to Download and Install Google Drive for Windows - MiniToolApr 23, 2025 am 12:45 AM

Google Drive offers apps for Windows and Mac. With the Google Drive desktop app, you can sync files more easily. This post from php.cn shows you how to download, install, and use Google Drive for Windows.

How to Fix Loading Lag Detected in Super People on Windows 10/11? - MiniToolHow to Fix Loading Lag Detected in Super People on Windows 10/11? - MiniToolApr 23, 2025 am 12:43 AM

Super People is one of the latest battle royal games that is published by Wonder Games and you can download it for free on the Steam client. When you play this game, you are likely to encounter Super People lag, low FPS and stuttering issues. Luckily

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version