Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Are there any functions fast than sccanf, sprintf, strlen?

Are there any functions fast than sccanf, sprintf, strlen?

Scheduled Pinned Locked Moved C / C++ / MFC
question
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    freehawk
    wrote on last edited by
    #1

    Hello everyone: Are there any functions fast than sccanf, sprintf, strlen? Thanks. -Freehawk

    H 1 Reply Last reply
    0
    • F freehawk

      Hello everyone: Are there any functions fast than sccanf, sprintf, strlen? Thanks. -Freehawk

      H Offline
      H Offline
      Henry miller
      wrote on last edited by
      #2

      Maybe. Before you start though I have two questions: Have you done a profile on your program and determined that you program is really spending a lot of time in those 3 functions. In most cases, despite those functions not being particularly good, they are good enough. Why are you not using a C++ string class, and the functions they provide to do the same? There are a number of them out there. Assuming you have good answers to those questions: strlen is best made faster by making a string class (or structure if you must do pure C) that holds the length of the string. Keeping this up to date can greatly speed up your program if strlen is called often. The other two are most easily taken care of by careful analysis of what you are doing with them. In most cases just knowing something about the data and how it is used can make solutions obvious. (for instance if you use sprintf to create a string, and sscanf to latter pull it apart, why create the string in the first place, just pass the data) Not knowing your data I cannot say more. I still suspect that this question is not worth asking.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups