[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: [PROGRAMMERING] sprintf problem



On 2008-10-03, Christian G. V. Bøgh <sslug@sslug> wrote:
> int main (int argc, char *argv[]) {
>    unsigned char systemCmd[50];
>    sprintf(systemCmd, "mount / –o,sync,remount");
>    printf("systemCmd = %s\n", systemCmd);
>    system(systemCmd);
> }
>
>
> Som giver dette output:
> \$ ./FileTest
> systemCmd = mount / o,sync,remount
> mount: mounting / on o,sync,remount failed: No such file or directory
>
>
> Problemet er at det '-' der står i sprintf forsvinder. Jeg har prøvet
> denne konstruktion i stedet:
>
>    sprintf(systemCmd, "mount / ");
>    strcat(systemCmd, "–");
>    strcat(systemCmd, "o,async,remount");
>    printf("systemCmd = %s\n", systemCmd);
>    system(systemCmd);
>
> men med samme resultat. Det frostår jeg ikke!
> Er der nogen der har en god forklaring på det?

Det er ikke en '-' men et grimt unicode-tegn der ligner til forveksling,
i hvert fald i det du har indsat her.

/Sune


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2008-11-01, 02:01 CET [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] *