USLANMAM

UslanmaM En Kaliteli Bilgi Adresiniz
USLANMAM öğesini iGoogle sayfanıza ekleyin.
Geri git   USLANMAM > PROGRAM > PROGRAMLAMA DİLLERİ > Programlama > C ve C++
UslanmaM Resim AlbümleriSosyal Gruplar
Kayıt ol Sosyal Gruplar Ajanda Konuları Okundu Kabul Et

Yeni Konu aç Cevapla
 
LinkBack Seçenekler Stil
Alt 03-28-2008, 10:11 AM   #1 (permalink)
Yarbay
 
Security - ait Kullanıcı Resmi (Avatar)
Standart Metin Dosyalarini Ters çeviren Kodlar

Metin Dosyasını Satır Satır Ters Çeviren Program (C)
Açıklama:Bu program komut satırından ismini aldığı bir text dosyasınından yeni bir text dosyası üretmektedir. Yeni üretilen dosya eski dosyanın satırlarının sözcük süzcük ters çevrilmiş biçimidir. Program komut satırından

convert

biçiminde çalıştırılmalıdır.


Ekran Çıktısı:Kaynak dosaya asagidaki gibi olsun

LOSING MY RELIGION

Life is bigger
It's bigger than you
And you are not me
The lengths that I will go to
The distance in your eyes
Oh no I've said too much
I set it up

That's me in the corner
That's me in the spotlight
Losing my religion
Trying to keep up with you
And I don't know if I can do it
Oh no I've said too much
I haven't said enough
I thought that I heard you laughing
I thought that I heard you sing
I think I thought I saw you try

Every whisper
Of every waking hour I'm
Choosing my confessions
Trying to keep an eye on you
Like a hurt lost and blinded fool
Oh no I've said too much
I set it up

Consider this
The hint of the century
Consider this
The slip that brought me
To my knees failed
What if all these fantasies
Come flailing around
Now I've said too much
I thought that I heard you laughing
I thought that I heard you sing
I think I thought I saw you try

But that was just a dream
That was just a dream

Bu dosyadan elde edilecek hedef dosya aşağıdaki gibi olacaktır.

RELIGION MY LOSING

bigger is Life
you than bigger It's
me not are you And
to go will I that lengths The
eyes your in distance The
much too said I've no Oh
up it set I

corner the in me That's
spotlight the in me That's
religion my Losing
you with up keep to Trying
it do can I if know don't I And
much too said I've no Oh
enough said haven't I
laughing you heard I that thought I
sing you heard I that thought I
try you saw I thought I think I

whisper Every
I'm hour waking every Of
confessions my Choosing
you on eye an keep to Trying
fool blinded and lost hurt a Like
much too said I've no Oh
up it set I

this Consider
century the of hint The
this Consider
me brought that slip The
failed knees my To
fantasies these all if What
around flailing Come
much too said I've Now
laughing you heard I that thought I
sing you heard I that thought I
try you saw I thought I think I

dream a just was that But
dream a just was That

Kaynak Kod:#include <stdio.h>
#include <string.h>
#include <ctype.h>

#define MAX_WORD_LEN 50
#define MAX_NAME_LEN 80
#define MAX_LINE_LEN 1000
#define BUFFER_SIZE MAX_LINE_LEN + 1


void revprint(const char *str FILE *fd)
{
char s[MAX_WORD_LEN + 1] = "";
int index = 0;
static const char seps[] = " \n\t.:;!?";

while (*str && strchr(seps *str))
str++;

if (!*str) {
return;
}

while (!strchr(seps *str))
s[index++] = *str++;

s[index] = '\0';

if (*str == '\0') {
fprintf(fd "%s " s);
return;
}

revprint(str fd);
fprintf(fd "%s " s);
}

int main(int argc char **argv)
{
FILE *fs *fd;
char sfname[MAX_NAME_LEN + 1];
char dfname[MAX_NAME_LEN + 1];
char buffer[BUFFER_SIZE];

if (argc != 3) {
printf("enter file name to convert : ");
gets(sfname);
printf("enter new file name : ");
gets(dfname);
}
else {
strcpy(sfname argv[1]);
strcpy(dfname argv[2]);
}

fs = fopen(sfname "r");

if (fs == aaaa) {
fprintf(stderr "cannot open %s!\n" sfname);
return 1;
}

fd = fopen(dfname "w");

if (fd == aaaa) {
fprintf(stderr "cannot create %s!\n" dfname);
fclose(fs);
return 2;
}

while (fgets(buffer BUFFER_SIZE fs)) {
revprint(buffer fd);
fprintf(fd "\n");
}

fclose(fs);
fclose(fd);

return 0;
}

Security isimli Üye şimdilik offline konumundadır  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Alıntı ile Cevapla
Alt 05-30-2008, 07:34 PM   #2 (permalink)
Onursal
 
Weasley - ait Kullanıcı Resmi (Avatar)
Standart

ya bu kod güselmiş paylaşım için teşekkürler
Weasley isimli Üye şimdilik offline konumundadır  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Alıntı ile Cevapla
Cevapla


Konuyu Toplam 1 Üye okuyor. (0 Kayıtlı üye ve 1 Misafir)
 
Seçenekler
Stil

Yetkileriniz
You may not post new threads
You may not post replies
Eklenti Ekleyemezsiniz
You may not edit your posts

BB code is Açık
Smileler Açık
[IMG] Kodları Açık
HTML-KodlarıKapalı
Trackbacks are Açık
Pingbacks are Açık
Refbacks are Açık
Gitmek istediğiniz klasörü seçiniz

Benzer Konular
Konu Konuyu Başlatan UslanmaM Cevaplar Son Mesaj
.cue dosyasi olmadan .bin dosyalarini cdye yazmak ROBERT_DE_NiRO Resimli Program Açıklamaları 0 08-30-2006 03:58 AM


Bütün Zaman Ayarları WEZ +2 olarak düzenlenmiştir. Şu Anki Saat: 05:35 AM .
Üyelerimiz görüşlerini önceden onay olmadan anında yazabilmektedir, bu yazılardan dolayı doğabilecek sorumluluklar yazan kullanıcılara aittir, UslanmaM yoneticileri itina ile icerik kontrolleri yapmaktadir, yine de UslanmaM' da yasalara aykırı unsurlar bulursanız İLETİŞİME veya 0555 582 46 56 numaralı telefona bildirebilirsiniz, gereği