Telefonino.net network
 
| HOMEPAGE | INDICE FORUM | REGOLAMENTO | ::. NEI PREFERITI .:: | RSS Forum | RSS News | NEWS web | NEWS software |
| PUBBLICITA' | | ARTICOLI | WIN XP | VISTA | WIN 7 | REGISTRI | SOFTWARE | MANUALI | RECENSIONI | LINUX | HUMOR | HARDWARE | DOWNLOAD | | CERCA nel FORUM » |

Torna indietro   WinTricks Forum > Software > Programmazione

Notices

Rispondi
 
Strumenti discussione
Vecchio 24-07-2007, 12.38.38   #1
Alhazred
Made in Japan
Top Poster
 
L'avatar di Alhazred
 
Registrato: 04-07-2001
Messaggi: 4.461
Alhazred promette bene
[C] data nel nome del file

Come faccio a creare un file ad esempio txt che abbia come nome la data e l'ora in cui è stato creato?

Una cosa tipo 2007-7-24 11-35-22.txt

Il formato 2007-7-24 11-35-22 riesco a stamparlo su console con:

SYSTEMTIME st;
GetSystemTime(&st);
printf("%d-%d-%d %d-%d-%d\n" ,st.wYear,st.wMonth,st.wDay,st.wHour,st.wMinute,st .wSecond);

ma non so come passarlo alla funzione fopen.

Idee?
Alhazred non è collegato   Rispondi citando
Vecchio 24-07-2007, 13.30.37   #2
UG0_BOSS
Young Promise
 
Registrato: 04-02-2006
Messaggi: 2.114
UG0_BOSS promette bene
Puoi usare la funzione sprintf() che fa lo stesso lavoro della sprintf ma anzichè mandare il risultato allo stdout lo manda ad una stringa:

Codice:
char nomefile[25];
SYSTEMTIME st;

GetSystemTime(&st);

sprintf(nomefile, "%d-%d-%d %d-%d-%d\n" ,st.wYear,st.wMonth,st.wDay,st.wHour,st.wMinute,st .wSecond);
UG0_BOSS non è collegato   Rispondi citando
Vecchio 24-07-2007, 16.29.06   #3
Alhazred
Made in Japan
Top Poster
 
L'avatar di Alhazred
 
Registrato: 04-07-2001
Messaggi: 4.461
Alhazred promette bene
Si, così funziona, grazie
Alhazred non è collegato   Rispondi citando
Rispondi


Utenti attualmente attivi che stanno leggendo questa discussione: 1 (0 utenti e 1 ospiti)
 
Strumenti discussione

Regole di scrittura
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is ON
Gli smilies sono ON
[IMG] è ON
Il codice HTML è OFF

Vai al forum

Discussioni simili
Discussione Autore discussione Forum Risposte Ultimo messaggio
log di AVAST...che faccio ? enry1 Sicurezza&Privacy 4 27-11-2008 19.38.09
HELP - Dato un file txt con dei nomi ogni rigo, come fare a copiare un certo file, ri Cavallaudo Windows 7/Vista/XP/ 2003 0 18-08-2007 20.16.41
[XP]Generic Host Process sgt_hellfire Windows 7/Vista/XP/ 2003 24 16-09-2006 15.06.59
[Windows XP] Problemi con il masterizzatore DVD Qgino Hardware e Overclock 13 16-10-2005 21.11.45
Virus o danni al registro? Eccomi Sicurezza&Privacy 21 23-05-2005 10.48.08

Orario GMT +2. Ora sono le: 14.42.39.


E' vietata la riproduzione, anche solo in parte, di contenuti e grafica.
Copyright © 1999-2017 Edizioni Master S.p.A. p.iva: 02105820787 • Tutti i diritti sono riservati
L'editore NON si assume nessuna responsabilità dei contenuti pubblicati sul forum in quanto redatti direttamente dagli utenti.
Questi ultimi sono responsabili dei contenuti da loro riportati nelle discussioni del forum
Powered by vBulletin - 2010 Copyright © Jelsoft Enterprises Limited.