LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-14-2014, 02:23 PM   #1
Mehedi Hasan
LQ Newbie
 
Registered: Aug 2014
Posts: 11

Rep: Reputation: Disabled
where do the results print?


In bsagent.cc file where or in which file the results print?


printf("Min_cost = %f\nlast_iter = %d\nCH are:\n", min_cost, last_iter);
for (int i=0; i<p_; i++)
printf("%f\t%f\t%d\n", ch_X[i], ch_Y[i], ch_index[i]);
fflush(stdout);

I cann't understand whether my change code in bsagent.cc file is working or not...

plz can anyone help me how i can see my change results in any file like .txt or tcl file.

thanks in advance...
 
Old 09-14-2014, 02:59 PM   #2
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 2,403

Rep: Reputation: Disabled
printf writes to stdout, so any output will appear in the terminal window (unless stdout is redirected with > or a pipe, of course).
 
Old 09-14-2014, 03:52 PM   #3
Mehedi Hasan
LQ Newbie
 
Registered: Aug 2014
Posts: 11

Original Poster
Rep: Reputation: Disabled
Sir,

I am using cygwin terminal...But i cann't see the output...

what is fflush(stdout)?
 
Old 09-14-2014, 03:57 PM   #4
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 2,403

Rep: Reputation: Disabled
fflush makes sure any cached data is "flushed" to the file stream; see here for more information.

You're saying you're running the program manually in a cygwin terminal window, but you're not seeing any output at all?
 
Old 09-14-2014, 04:06 PM   #5
Mehedi Hasan
LQ Newbie
 
Registered: Aug 2014
Posts: 11

Original Poster
Rep: Reputation: Disabled
sir,
in cygwin terminal i only give the command
make

how can i run manually?
 
Old 09-14-2014, 04:17 PM   #6
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 2,403

Rep: Reputation: Disabled
Right.

The make command will, under the right circumstances, compile your program. That is, convert the stuff you've written in C or C++ into something the computer can actually run.

Take a look in the directory where you ran the make command. There should be a new file there, one that wasn't there before you ran make. That's the program, and you must type the name of that file preceded by "./" to run it. Example: ./myprogram.o.
 
Old 09-14-2014, 04:45 PM   #7
Mehedi Hasan
LQ Newbie
 
Registered: Aug 2014
Posts: 11

Original Poster
Rep: Reputation: Disabled
It makes this error

./bsagent.o :can not read binary file

in the directory mit/uAMPS bsagent.o file is created after running the 'make' command
 
Old 09-14-2014, 05:17 PM   #8
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,275

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
A .o file is usually an object file, not an executables. Object files must be linked to produce an executable. Usually this is handled by the Makefile. Are you sure there's no executable in your directory after typing "make"? Did you not get any instructions for how to run the program?
 
Old 09-15-2014, 02:42 AM   #9
Mehedi Hasan
LQ Newbie
 
Registered: Aug 2014
Posts: 11

Original Poster
Rep: Reputation: Disabled
sir,

plz tell me the procedure how i can see the printed results from bsagent.cc file...

I have installed Leach protocol in ns-2.34 in windows XP...

I run the program from cygwin terminal...

first i 'make' the file then run './leach_test' which produce results in leach_sims folder...
but i cann't see the printed values in any file...

new in ns-2

plz support me the best as you can...

thanks
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to print tcpdump results to text file lex07123 Linux - Networking 1 02-03-2013 02:50 AM
[SOLVED] how do I edit a clisp scipt to print results to txt klambo Linux - Newbie 4 07-11-2011 12:20 PM
Match and Print the results in different files Priyabio Programming 4 08-27-2009 12:09 PM
'find' gives different results when using -mtime with -print vs -exec BrianK Linux - General 1 12-08-2008 11:32 AM
Results of print job a nightmare loadedmind Linux - Hardware 4 01-04-2004 11:09 PM


All times are GMT -5. The time now is 02:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration