C / C++ Code Portfolio



Download 112,15 Kb.
bet11/30
Sana01.03.2022
Hajmi112,15 Kb.
#475852
1   ...   7   8   9   10   11   12   13   14   ...   30
Bog'liq
dddd

return -1;
}
else
{
// execute loop until a break statement is encountered
for (;;)
{
// get the next byte of data from the inFile
int valToAppend = fgetc(appendData);
// if the next byte of data is an EOF, break out of for loop
if (valToAppend == EOF)
{
break;
}
// append the byte of data from inFile to outFile
fputc(valToAppend, fileToBeAppendedTo);
}
// close both files and return success
fclose(fileToBeAppendedTo);
fclose(appendData);
return 0;
}
}
// This function appends data from one file to the end of another file

#include


#include

using namespace std;

// AppendFile opens the file described by outFile and appends the file described by inFile to the end of it


int AppendFile(const char *inFile, const char *outFile)
{
// open the file to be appended to in write-only append mode
ofstream fileToBeAppendedTo(outFile, ios_base::app);
// open the file containing the data to append in read-only mode
ifstream appendData(inFile);
// if either file doesn't open for some reason, print an error message and quit
if (!fileToBeAppendedTo.is_open() || !appendData.is_open())
{
cerr << "Could not open a file\n";
return -1;
}
else
{
// execute loop until a break statement is encountered
for (;;)
{
// get the next byte of data from the inFile
char valToAppend;
appendData.get(valToAppend);
// if the next byte of data is an EOF, break out of for loop
if (appendData.eof())
{
break;
}
// append the byte of data from inFile to outFile
fileToBeAppendedTo.put(valToAppend);
}
// close both files and return success
fileToBeAppendedTo.close();
appendData.close();
return 0;
}
}
// This function opens, merges, and displays the contents of multiple files

#include


#include
#include
#include


Download 112,15 Kb.

Do'stlaringiz bilan baham:
1   ...   7   8   9   10   11   12   13   14   ...   30




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish