Twoje PC  
Zarejestruj się na Twoje PC
TwojePC.pl | PC | Komputery, nowe technologie, recenzje, testy
B O A R D
   » Board
 » Zadaj pytanie
 » Archiwum
 » Szukaj
 » Stylizacja

 
M E N U
  0
 » Nowości
0
 » Archiwum
0
 » Recenzje / Testy
0
 » Board
0
 » Rejestracja
0
0
 
Szukaj @ TwojePC
 

w Newsach i na Boardzie
 
OBECNI NA TPC
 
 » Mademan 02:01
 » Martens 01:44
 » piszczyk 00:48
 » ReeX 00:36
 » wrrr 00:29
 » abes99 00:25
 » ManiusNG 00:22
 » ham_solo 00:11
 » Wedrowiec 00:10
 » Kenny 00:04
 » biEski 23:57
 » SebaSTS 23:44
 » Arlathan 23:33
 » Dexter 23:27
 » siwydym 23:26
 » Fl@sh 23:19
 » marcin502 23:16
 » patinka 23:16
 » Wolf 23:02
 » rainy 23:00

 Dzisiaj przeczytano
 3333 postów,
 wczoraj 30516

 Szybkie ładowanie
 jest:
włączone.

 
ccc
TwojePC.pl © 2001 - 2025
A R C H I W A L N A   W I A D O M O Ś Ć
    

Prosba o pomoc z C - wypisanie wartosci wskaznika do pliku. , majlosh 6/11/06 13:11
Witam!

Zaimplementowalem drzewo bst w jezyku C, dane pobieram z bst.in, musze wypisac je w postaci inorder to pliku inorder.out. Moja funkcja print_inorder z wypisywaniem na ekran wyglada nastepujaco:

void print_inorder (tree_t node)
{
if (node) {
print_inorder (node-left);
printf('%d\n', node-key);
print_inorder (node-right);
}
}

Jak wypisac wartosc node-key do pliku file_out? Funkcja fputs()? Czy ktos moglby mnie oswiecic jak to zrobic?

Z gory dziekuje i pozdrawiam.

P.S. W funkcji printf ' to normalny cudzyslow, a node-key to poprawne wskazanie na wartosc key w strukturze node, tylko cos w podgladzie nie wygladalo to za dobrze...

They dont know that we know they know we know

  1. mala pomoc , biEski 6/11/06 19:19
    http://www.imada.sdu.dk/...ION00011000000000000000

  2. Hmm , majlosh 6/11/06 19:39
    moja funkcja wyglada teraz tak:
    void print_inorder (tree_t node, FILE *plik)
    {
    if (node) {
    char buf[50];
            print_inorder (node->left, plik);
            buf[0]='\0';
            sprintf(buf,"%i\n",node->key);
            fputs(buf,plik);                                //87 linijka
            print_inorder (node->right, plik);
            }
    }

    a gcc wywala mi blad:
    main2.c: In function ‘print_inorder’:
    main2.c:87: error: stray ‘\302’ in program
    main2.c:87: error: stray ‘\240’ in program
    main2.c:87: error: stray ‘\302’ in program
    main2.c:87: error: stray ‘\240’ in program
    main2.c:87: error: stray ‘\302’ in program
    main2.c:87: error: stray ‘\240’ in program
    main2.c:87: error: stray ‘\302’ in program
    main2.c:87: error: stray ‘\240’ in program

    Nie wiem co to znaczy :(

    They dont know that we know they know we know

    1. tzn blad typu , majlosh 6/11/06 19:40
      error: stray \240 in program

      They dont know that we know they know we know

      1. google mowia tak: , biEski 6/11/06 20:16
        > vector.cpp:12: error: stray '\302' in program
        > vector.cpp:12: error: stray '\240' in program

        These errors are most likely caused by copy-pasting the program from
        your news-reader to your editor.
        One time-consuming, but effective, way to get rid of them is by
        re-typing the program. :-) As I encountered a similar problem, I have
        written a small filter program that gets rid of these troublesome
        characters. Feel free to request a copy by e-mail (I could post it
        here, but then you would have to copy it from your news-reader, and
        that is what, IMO, started the trouble.)

        1. Dziala :) , majlosh 6/11/06 20:38
          Tzn linijka 87 nie byla "styldowana" tylko "spacjowana", blad typu CRLF or something, skompilowalo sie i dziala. Dziekuje za zainteresowanie i pozdrawiam :)

          They dont know that we know they know we know

          1. no problem , biEski 6/11/06 22:29
            ...

    
All rights reserved ® Copyright and Design 2001-2025, TwojePC.PL