Visualizzazione dei risultati da 1 a 5 su 5
  1. #1
    Utente di HTML.it L'avatar di Xadoom
    Registrato dal
    Dec 2002
    Messaggi
    1,491

    [c/c++]parametri sprintf

    Vorrei sapere il II parametro che devo passare alla funzione sprintf() per formattare un intero di tre cifre, cioè se l'intero è 4 mi visualizzi 004.
    Grazie.
    Windows Xp
    [Java]
    [PHP]Notepad++
    [Fortran90-77] elf90 g77
    [C++ /WinAPI] DevC++ VisualC++

  2. #2
    Utente di HTML.it L'avatar di Xadoom
    Registrato dal
    Dec 2002
    Messaggi
    1,491
    Trovato: "%03i"
    Dove trovo una lista di tutti questi parametri?
    Windows Xp
    [Java]
    [PHP]Notepad++
    [Fortran90-77] elf90 g77
    [C++ /WinAPI] DevC++ VisualC++

  3. #3
    potevi scrivere anche: "%.3d"

    http://www.cplusplus.com/ref/cstdio/sprintf.html
    ...Terrible warlords, good warlords, and an english song

  4. #4
    Utente di HTML.it L'avatar di Xadoom
    Registrato dal
    Dec 2002
    Messaggi
    1,491
    Grassie.....
    Windows Xp
    [Java]
    [PHP]Notepad++
    [Fortran90-77] elf90 g77
    [C++ /WinAPI] DevC++ VisualC++

  5. #5
    Utente di HTML.it L'avatar di pdpmpd
    Registrato dal
    Jan 2003
    Messaggi
    448
    su linux fai "man 3 printf" e sono elencati tutti i parametri.
    Drug misuse is not a disease, it is a decision, like the decision to step out in front of a moving car. [...] In this particular life-style the motto is "be happy now because tomorrow you are dying", but the dying begins almost at once, and the happiness is a memory.

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.