Academic Tutorials



English | French | Portugese | Dutch | Italian
Google

in linea

Domestico Codici sorgente E-Libri Trasferimenti dal sistema centrale verso i satelliti Metterseli in contatto con Circa noi

HTML Tutorials
HTML Tutorial
XHTML Tutorial
CSS Tutorial
TCP/IP Tutorial
CSS 1.0
CSS 2.0
HLML
XML Tutorials
XML Tutorial
XSL Tutorial
XSLT Tutorial
DTD Tutorial
Schema Tutorial
XForms Tutorial
XSL-FO Tutorial
XML DOM Tutorial
XLink Tutorial
XQuery Tutorial
XPath Tutorial
XPointer Tutorial
RDF Tutorial
SOAP Tutorial
WSDL Tutorial
RSS Tutorial
WAP Tutorial
Web Services Tutorial
Browser Scripting
JavaScript Tutorial
VBScript Tutorial
DHTML Tutorial
HTML DOM Tutorial
WMLScript Tutorial
E4X Tutorial
Server Scripting
ASP Tutorial
PERL Tutorial
SQL Tutorial
ADO Tutorial
CVS
Python
Apple Script
PL/SQL Tutorial
SQL Server
PHP
.NET (dotnet)
Microsoft.Net
ASP.Net
.Net Mobile
C# : C Sharp
ADO.NET
VB.NET
VC++
Multimedia
SVG Tutorial
Flash Tutorial
Media Tutorial
SMIL Tutorial
Photoshop Tutorial
Gimp Tutorial
Matlab
Gnuplot Programming
GIF Animation Tutorial
Scientific Visualization Tutorial
Graphics
Web Building
Web Browsers
Web Hosting
W3C Tutorial
Web Building
Web Quality
Web Semantic
Web Careers
Weblogic Tutorial
SEO
Web Site Hosting
Domain Name
Java Tutorials
Java Tutorial
JSP Tutorial
Servlets Tutorial
Struts Tutorial
EJB Tutorial
JMS Tutorial
JMX Tutorial
Eclipse
J2ME
JBOSS
Programming Langauges
C Tutorial
C++ Tutorial
Visual Basic Tutorial
Data Structures Using C
Cobol
Assembly Language
Mainframe
Forth Programming
Lisp Programming
Pascal
Delphi
Fortran
OOPs
Data Warehousing
CGI Programming
Emacs Tutorial
Gnome
ILU
Soft Skills
Communication Skills
Time Management
Project Management
Team Work
Leadership Skills
Corporate Communication
Negotiation Skills
Database Tutorials
Oracle
MySQL
Operating System
BSD
Symbian
Unix
Internet
IP-Masquerading
IPC
MIDI
Software Testing
Testing
Firewalls
SAP Module
ERP
ABAP
Business Warehousing
SAP Basis
Material Management
Sales & Distribution
Human Resource
Netweaver
Customer Relationship Management
Production and Planning
Networking Programming
Corba Tutorial
Networking Tutorial
Microsoft Office
Microsoft Word
Microsoft Outlook
Microsoft PowerPoint
Microsoft Publisher
Microsoft Excel
Microsoft Front Page
Microsoft InfoPath
Microsoft Access
Accounting
Financial Accounting
Managerial Accounting


Funzioni dell'ingresso/uscita della lima in C
Previous Next




Maneggiamento del file C - indicatori di lima

Usare un nuovo datatype denominato un indicatore di lima con ai file C. Questo tipo è scritto come LIMA * ed è definito all'interno di stdio.h. Un indicatore di lima denominato output_file è dichiarato in una dichiarazione è come segue:

FILE *output_file;



Function Name Operation
fopen() Creates a new file for use
Opens a new existing file for use
fclose Closes a file which has been opened for use
getc() Reads a character from
putc() Writes a character to a file
fprintf() Writes a set of data values to a file
fscanf() Reads a set of data values from a file
getw() Reads a integer from a file
putw() Writes an integer to the file
fseek() Sets the position to a desired point in the file
ftell() Gives the current position in the file
rewind() Sets the position to the begining of the file



Aprendo usando dell'indicatore di lima fopen ()

Per aprire i flussi, fopen () è usato. Per l'apertura archivia per input, questo è il più usato spesso. Prima che possa accedergli, il vostro programma deve aprire una lima. Questa funzione restituisce l'indicatore di lima richiesto. La POSIZIONE DI SEGNALE MINIMO di valore sarà restituita, se la lima non può essere aperta per alcun motivo. il prototipo dei fopen è come segue:

FILE *fopen (const char *path, const char *mode);

fopen contiene il percorso alla lima così come il modo ed aprire la lima con. Prendere per il seguente esempio:

iFILE *Fp; Fp = fopen("/home/johndoe/input.dat", "r");

Per lettura, questo aprirà la lima in /home/johndoe/input.dat. Userete solitamente fopen come dato qui sotto:

if ((output_file = fopen("output_file", "w")) == NULL)
fprintf(stderr, "Cannot open %s\n", "output_file");



fopen gli introiti due discussioni, entrambe sono stringhe, il primo è il nome della lima da aprire, il secondo è un carattere di accesso, che è solitamente uno di quanto segue:

  1. apertura "r" - della lima per lettura
  2. apertura "a" - della lima per collegare
  3. apertura "W" - della lima per scrittura
  4. "w+" - aprir per la scrittura e la lettura (la lima attuale sarà scritta sopra)
  5. "R+" - aprir per la lettura e l'aggiornamento (lima deve già esistere)
  6. "a+" - aprir per collegare e la lettura (lima può o meno esistere)

I seguenti fragmentis di codice hanno usato ottenere il testo dal primo elemento del <title>:

FILE *output_file;



Chiudendo un indicatore di lima usando fclose ()

Usereste il fclose () per chiudere il flusso. Il prototipo per fclose è dato qui sotto:

int fclose( FILE *stream );



Ingresso/uscita della lima:: fgets ()

Le alternative a scanf/fscanf è fgets. Il prototipo è come segue:

char *fgets(char *s, int size, FILE *stream);

i fgets la immagazzina nell'indicatore dei *s e legge dentro il formato - caratteri 1 dal flusso. La stringa sempre nullo-è terminata automaticamente. Se raggiunge un EOF o un newline, i fgets smette di leggere nei caratteri.




Ingresso/uscita della lima:: sscanf ()

La chiamata della biblioteca dello sscanf è pratica esplorare una stringa per una disposizione. Il prototipo è come segue:

int sscanf(const char *str, const char *format, ...);

lo sscanf prende un indicatore del carattere anziché un indicatore di lima e funziona tanto come fscanf. Anziché scanf/fscanf, usando la combinazione di fgets/sscanf potete evitare il problema “di digestione„ (o insetto, secondo chi comunicate con:)




Ingresso/uscita della lima:: fprintf ()

  • È a volte utile inoltre da produrre ai flussi differenti.
  • il fprintf () permette che noi facciamo esattamente la stessa cosa
  • Il prototipo per fprintf è come segue:
  • int fprintf(FILE *stream, const char *format, ...);

    il fprintf contiene un indicatore speciale denominato un indicatore di lima, indicato la LIMA *. Allora accetta la discussione e una stringa di formattazione e. L'unica differenza fra printf e fprintf è che il fprintf può riorientare l'uscita ad un flusso particolare. Questi flussi possono essere stderr, stdout, o un indicatore di lima. Più sugli indicatori di lima quando otteniamo fopen. Un esempio è fornito qui sotto:

    fprintf(stderr, "ERROR: Cannot malloc enough memory.\n");

    Questa uscita il messaggio di errore all'errore standard.




    Ingresso/uscita della lima:: fscanf ()

    il fscanf () è basicamente una versione dei flussi dello scanf. Il prototipo per fscanf è come segue:

    int fscanf( FILE *stream, const char *format, ...);
    Ingresso/uscita della lima:: fflush ()

    Se il programma si arresta, a volte il flusso non è scritto. Potete fare questo usando la funzione del fflush (). Un momento è necessario validamente da irrigare un amplificatore al relativo flusso. Il prototipo per fflush è come segue:

    int fflush(FILE *stream);

    Non molto difficile usare, specificare il flusso a fflush.

    Il programma che è dato sotto uso delle esposizioni dei funzionamenti della lima. Il programma lo scrive ed i dati entrano tramite la tastiera. Carattere dal carattere, archiviare input. La conclusione dei dati è indicata entrando in un carattere di EOF, che è controllo-z. l'input della lima è chiuso a questo segnale soltanto.

    #include< stdio.h >

    main()
    {
    file *f1;
    printf("Data input output");
    f1=fopen(Input,w); /*Open the file Input*/
    while((c=getchar())!=EOF) /*get a character from key board*/
    putc(c,f1); /*write a character to input*/
    fclose(f1); /*close the file input*/
    printf("\nData output\n");
    f1=fopen(INPUT,r); /*Reopen the file input*/
    while((c=getc(f1))!=EOF)
    printf("%c",c);
    fclose(f1);
    }




    Previous Next

    Keywords: perl functions, c tutorial, php functions, c array, c time, c programs, c examples, c language, c library, c dll, unix c, c program, c example, standard c, array functions, file open, variable functions, unix file, functions tutorial, functions examples, file read, file write, simple c, sample c, variable c, functions example


    HTML Quizes
    HTML Quiz
    XHTML Quiz
    CSS Quiz
    TCP/IP Quiz
    CSS 1.0 Quiz
    CSS 2.0 Quiz
    HLML Quiz
    XML Quizes
    XML Quiz
    XSL Quiz
    XSLT Quiz
    DTD Quiz
    Schema Quiz
    XForms Quiz
    XSL-FO Quiz
    XML DOM Quiz
    XLink Quiz
    XQuery Quiz
    XPath Quiz
    XPointer Quiz
    RDF Quiz
    SOAP Quiz
    WSDL Quiz
    RSS Quiz
    WAP Quiz
    Web Services Quiz
    Browser Scripting Quizes
    JavaScript Quiz
    VBScript Quiz
    DHTML Quiz
    HTML DOM Quiz
    WMLScript Quiz
    E4X Quiz
    Server Scripting Quizes
    ASP Quiz
    PERL Quiz
    SQL Quiz
    ADO Quiz
    CVS Quiz
    Python Quiz
    Apple Script Quiz
    PL/SQL Quiz
    SQL Server Quiz
    PHP Quiz
    .NET (dotnet) Quizes
    Microsoft.Net Quiz
    ASP.Net Quiz
    .Net Mobile Quiz
    C# : C Sharp Quiz
    ADO.NET Quiz
    VB.NET Quiz
    VC++ Quiz
    Multimedia Quizes
    SVG Quiz
    Flash Quiz
    Media Quiz
    SMIL Quiz
    Photoshop Quiz
    Gimp Quiz
    Matlab Quiz
    Gnuplot Programming Quiz
    GIF Animation Quiz
    Scientific Visualization Quiz
    Graphics Quiz
    Web Building  Quizes
    Web Browsers Quiz
    Web Hosting Quiz
    W3C Quiz
    Web Building Quiz
    Web Quality Quiz
    Web Semantic Quiz
    Web Careers Quiz
    Weblogic Quiz
    SEO Quiz
    Web Site Hosting Quiz
    Domain Name Quiz
    Java Quizes
    Java Quiz
    JSP Quiz
    Servlets Quiz
    Struts Quiz
    EJB Quiz
    JMS Quiz
    JMX Quiz
    Eclipse Quiz
    J2ME Quiz
    JBOSS Quiz
    Programming Langauges Quizes
    C Quiz
    C++ Quiz
    Visual Basic Quiz
    Data Structures Using C Quiz
    Cobol Quiz
    Assembly Language Quiz
    Mainframe Quiz
    Forth Programming Quiz
    Lisp Programming Quiz
    Pascal Quiz
    Delphi Quiz
    Fortran Quiz
    OOPs Quiz
    Data Warehousing Quiz
    CGI Programming Quiz
    Emacs Quiz
    Gnome Quiz
    ILU Quiz
    Soft Skills Quizes
    Communication Skills Quiz
    Time Management Quiz
    Project Management Quiz
    Team Work Quiz
    Leadership Skills Quiz
    Corporate Communication Quiz
    Negotiation Skills Quiz
    Database Quizes
    Oracle Quiz
    MySQL Quiz
    Operating System Quizes
    BSD Quiz
    Symbian Quiz
    Unix Quiz
    Internet Quiz
    IP-Masquerading Quiz
    IPC Quiz
    MIDI Quiz
    Software Testing Quizes
    Testing Quiz
    Firewalls Quiz
    SAP Module Quizes
    ERP Quiz
    ABAP Quiz
    Business Warehousing Quiz
    SAP Basis Quiz
    Material Management Quiz
    Sales & Distribution Quiz
    Human Resource Quiz
    Netweaver Quiz
    Customer Relationship Management Quiz
    Production and Planning Quiz
    Networking Programming Quizes
    Corba Quiz
    Networking Quiz
    Microsoft Office Quizes
    Microsoft Word Quiz
    Microsoft Outlook Quiz
    Microsoft PowerPoint Quiz
    Microsoft Publisher Quiz
    Microsoft Excel Quiz
    Microsoft Front Page Quiz
    Microsoft InfoPath Quiz
    Microsoft Access Quiz
    Accounting Quizes
    Financial Accounting Quiz
    Managerial Accounting Quiz

    Privacy Policy
    Copyright © 2003-2024 Vyom Technosoft Pvt. Ltd., All Rights Reserved.