SORU
9 EYLÜL 2008, Salı


Nasıl C string dosya uzantısı

Bir dize "dosya adı."ne için uzatma parçası olun. conf

Çapraz platform bir çözüm istiyorum.

CEVAP
9 EYLÜL 2008, Salı


Bu çözüm çok basit.

#include <iostream>
#include<string>

int main()
{
  std::string fn = "filename.conf";
  if(fn.substr(fn.find_last_of(".")   1) == "conf") {
    std::cout << "Yes..." << std::endl;
  } else {
    std::cout << "No..." << std::endl;
  }
}

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Anthony Cumia

    Anthony Cumi

    5 EYLÜL 2006
  • celebrateubuntu

    celebrateubu

    23 Mayıs 2011
  • Erica Griffin

    Erica Griffi

    8 HAZİRAN 2009