TwojePC.pl © 2001 - 2024
|
|
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 - mala pomoc , biEski 6/11/06 19:19
http://www.imada.sdu.dk/...ION00011000000000000000 - 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 - tzn blad typu , majlosh 6/11/06 19:40
error: stray \240 in programThey dont know that we know they know we know - 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.)- 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 - no problem , biEski 6/11/06 22:29
...
|
|
|
|
|
All rights reserved ® Copyright and Design 2001-2024, TwojePC.PL |
|
|
|
|