[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [CPROG] putchar/backspace



On Thu, 8 Jul 1999, Sune Fischer wrote:

> void main()

Altid int main!

Du har ogsaa glemt at inkludere stdio.h. Husk at kompilere med gcc -Wall
-W for at faa alle warnings med, de er vigtige.

>   unsigned char *s;
>   
>   while(s[0]!='q')
>     {
>       printf("Indtast et tegn: ");
>       scanf("%s",s);

Dette overskriver hvad "s" nu peger paa, altsaa et tilfaeldigt sted i
hukommelsen!

Du skal erklaere s som fx:

char s[256];

Og saa bruge:

scanf("%256s", s);

Hvis du bare bruger %s, saa hvis der bliver skrevet over 256 tegn..
overskrives noget af din hukommelse. Det den slags fejl folk typisk kan
benytte for at bryde ind i et UNIX system.

-- 
==============================================================================
Erwin Andreasen   Herlev, Denmark <sslug@sslug>          UNIX System Programmer
<URL:http://www.andreasen.org>              <*>         (not speaking for) DDE
==============================================================================



 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:07 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *