do you mean like this:
"
char mybuffer[];
fstream sumber("smb.conf");
if (!sumber){
cout << "Failed in opening the 'smb.conf'
file\n";
exit(1);
}
sumber >> mybuffer;
cout << mybuffer << endl;
"?
Please tell me more details. Could you give me a very
simple sample?
Thank you very much for your generousity.
--- Alan Lenton <alan(a)ibgames.com> wrote:
> Prabu Subroto wrote:
> > Dear my friend.
> >
> > I want to make a linux server administrating tool
> ( I
> > am also a beginner in GNU C++).
> >
> > if I open the file (smb.conf) with ifstream and
> try to
> > display its content with cout, but it does not
> display
> > its content only somewhat looksline only an
> address of
> > the variable in the memory.
> > like this:
> > "
> > psubroto@vh64:~/arsip/proyek/g++/BLiSS> ./liss
> > Choose the server you would like to administrate :
> > 1. Samba Server
> > 1
> > Samba Server Administrating Menu
> > --------------------------------
> >
> > Workgroup name :bitp
> > nama workgroup-nya : bitp
> > 0xbfffef64
> > psubroto@vh64:~/arsip/proyek/g++/BLiSS>
> > "
> >
> > what is my mistake?
> [snip...]
>
> > void bsamba::menu(){
> > cout << "Samba Server Administrating Menu\n";
> > cout << "--------------------------------\n"
> <<
> > endl;
> > cout << "Workgroup name :";
> > cin >> bwg;
> >
> > cout << "nama workgroup-nya : " << bwg <<
> endl;
> > fstream sumber("smb.conf");
> > if (!sumber){
> > cout << "Failed in opening the 'smb.conf'
> > file\n";
> > exit(1);
> > }
> > cout << sumber << endl;
> > }
>
> [snip...]
>
> What you have asked it to print out is not the file,
> but the address of
> the stream. You need to use the stream (sumber) to
> read the file into a
> buffer and then write the buffer out to cout :)
>
> alan
>
__________________________________
Do you Yahoo!?
Yahoo! Mail - Find what you need with new enhanced search.
http://info.mail.yahoo.com/mail_250
Dear my friend.
I want to make a linux server administrating tool ( I
am also a beginner in GNU C++).
if I open the file (smb.conf) with ifstream and try to
display its content with cout, but it does not display
its content only somewhat looksline only an address of
the variable in the memory.
like this:
"
psubroto@vh64:~/arsip/proyek/g++/BLiSS> ./liss
Choose the server you would like to administrate :
1. Samba Server
1
Samba Server Administrating Menu
--------------------------------
Workgroup name :bitp
nama workgroup-nya : bitp
0xbfffef64
psubroto@vh64:~/arsip/proyek/g++/BLiSS>
"
what is my mistake?
Here is my code underbelow.
=====
psubroto@vh64:~/arsip/proyek/g++/BLiSS> ls
bsamba.h bsamba.h~ liss liss.cpp liss.cpp~
smb.conf
psubroto@vh64:~/arsip/proyek/g++/BLiSS> cat bsamba.h
// Time-Stamp:<>
#include<stdlib.h>
#include<iostream.h>
#include<fstream.h>
class bsamba {
private:
public:
void menu();
char bwg[];
void mengedit();
char Puffer[];
};
void bsamba::menu(){
cout << "Samba Server Administrating Menu\n";
cout << "--------------------------------\n" <<
endl;
cout << "Workgroup name :";
cin >> bwg;
cout << "nama workgroup-nya : " << bwg << endl;
fstream sumber("smb.conf");
if (!sumber){
cout << "Failed in opening the 'smb.conf'
file\n";
exit(1);
}
cout << sumber << endl;
}
void bsamba::mengedit(){
}
psubroto@vh64:~/arsip/proyek/g++/BLiSS> cat liss.cpp
// Time-Stamp: <>
#include<iostream.h>
#include<stdlib.h>
#include "bsamba.h"
int main(int argc, char **argv){
int svr;
// for (;;){
cout << "Choose the server you would like to
administrate :" << endl;
cout << "1. Samba Server" << endl;
cin >> svr;
switch (svr){
case 1:
bsamba * sm = new bsamba();
sm->menu();
break;
}
}
psubroto@vh64:~/arsip/proyek/g++/BLiSS>
__________________________________
Do you Yahoo!?
Yahoo! Mail - now with 250MB free storage. Learn more.
http://info.mail.yahoo.com/mail_250
Hello
I've been tasked to port a PCI device from Solaris to Linux. I know
something about Solaris drivers and next to nothing about Linux drivers.
Can someone point me to their favorite example of a PCI driver that they
used as a starting point? There's a fair bit of DMA involved as well.
TIA & Cheers
I need perl, or something equivalent to it to read through a file
checking for a line containing /fs/fs/fs and to change this to /fs.
This line may have either a /fs, /fs/fs or a /fs/fs/fs/fs; it will
always start in the first position, so ^ is good to use.
There are other lines in this file and the lines can not get out of
order.
I know I can do something like perl -p -i.bak -e 's/\/fs/fs\\/fs/g'
filecheck but this command does not like the /fs/fs/fs's.
Any thoughts and thank you!
Dear List,
Thanks for the assistance with the Java less-than key problem. Everyone
who could not reproduce the problem was using a different keyboard map setting
than me.
As one list subscriber suggested, that was the secret. After spending
more time on this than I care to admit, and changing several things that made
no difference, one change finally fixed it for my (standard?) keyboard.
If anybody cares, I changed the KDE keyboard layout from
"U.S. English (us)" to "U.S. English w/ISO9995-3 (en_US)" as follows:
In KDE under SuSE9.2:
K Menu->Control Center->Regional&Accessibility->Keyboard Layout
Remove current keyboard layout: Under "Active Layouts", click
"U.S. English (us)" icon, then click "<<Remove".
Under "Available Layouts", click "U.S.English w/ISO999-3
(en_US)", then click "Add>>"
Click "Apply" near bottom of window.
Close control panel
Log-out of KDE
When you log-in, the less-than key, and every other keyboard key
work correctly in Java AWT.
Yippee!! Wahoo!!! Life is good again!!!!
> Hello,
>
> I've been fighting with a Java problem that only appears on Intel SuSE Pro
> 9.0-9.2 machines running KDE (as far as I know). When using the keyboard to
> enter text into an AWT TextField. Less-than "<" is getting converted to
> greater-than ">".
On Monday 10 January 2005 21:51, Peter Szaban wrote:
> Hello,
>
> I've been fighting with a Java problem that only appears on Intel
> SuSE Pro 9.0-9.2 machines running KDE (as far as I know). When using the
> keyboard to enter text into an AWT TextField. Less-than "<" is getting
> converted to greater-than ">".
I tried your sample program and observed the same result.
Other GUI builders I tried didn't have that problem.
--
Ebenezer Ntienjem
mailto: ntienjem(a)netscape.net
__________________________________________________________________
Switch to Netscape Internet Service.
As low as $9.95 a month -- Sign up today at http://isp.netscape.com/register
Netscape. Just the Net You Need.
New! Netscape Toolbar for Internet Explorer
Search from anywhere on the Web and block those annoying pop-ups.
Download now at http://channels.netscape.com/ns/search/install.jsp
Hello,
I've been fighting with a Java problem that only appears on Intel SuSE Pro
9.0-9.2 machines running KDE (as far as I know). When using the keyboard to
enter text into an AWT TextField. Less-than "<" is getting converted to
greater-than ">".
Yast says keyboard is set to "English (US)". For fun, I tried "export
LANG=en_US" (as opposed to en_US.UTF-8) to no avail. I am not (knowingly)
messing with keymaps anywhere.
Java appears to recognize the keycodes properly, as it correctly
interprets the un-SHIFT-ed key as comma ",". A preloaded less-than sign
is correctly displayed, but when the less-than key (SHIFT-comma) is entered at
the keyboard, it gets converted to greater-than.
Anybody else experienced this, or worked around it? Any helpful comments
would be much appreciated.
Maybe I'm just dense, but I can't find any key combination that will put a
less-than sign in the TextField. Here's a sample program to illustrate
the problem. Run the program and try keying a less-than sign into the
TextField:
8X-------------- Test7.java ----------------------------X8
// Compiled with: /usr/lib/java/bin/javac Test7.java
// Executed from Konsole window with: /usr/lib/java/bin/java Test7
import java.awt.*;
public class Test7
{
public static void main( String argv[] )
{
Dialog d = new Dialog( new Frame() );
TextField ts = new TextField( "Try typing a < in here" );
d.add( ts );
d.pack();
d.setVisible( true );
}
}
8X-------------- Test7.java ----------------------------X8
Java version:
$ rpm -qa | grep java
java-1_4_2-sun-1.4.2.05-9
java-1_4_2-sun-devel-1.4.2.05-9
Hi,
I'm looking for a tool or compiler options if any that can profile the
machine instructions of a dynamic C program to see the behaviour of
program given a parameter. Since the program is dynamic depending on
the parameter given, i'd like to know the number of instructions
(memory and non-memory) each in exact counts to know which
instructions are executed the most.
I have tried gprof, but gprof only counts the number of function
calls. While gcc -S gives the assembly of the source code only
(static). So, is there a way to profile during execution since the C
program is dynamic in order to get a complete profile of the machine
instructions of the program?
Regards,
Cindy
cincaipatron(a)gmx.net writes:
> John Lamb wrote:
>> cincaipatron(a)gmx.net wrote:
>>> Hi,
>>>
>>> how to get the assembly-instructions profile of a program
>>> in Linux (or Unix in general), similar with what gprof
>>> does, just that gprof is in higher-language (C/C++) level?
>> I'm not entirely sure what you mean, but g++/gcc -S might be what you
>> want. It creates a file 'file.s' with the assembly instructions in it.
> Well, seems that I need more than what gcc -S provides, because
> it's like producing the "source code" in assembly languages.
> What I'm looking for is something similar with what gprof does,
> such as which instruction is called most often, how many times,
> etc., or maybe the assembly-instruction is part of which function
> (in C/C++).
If you have already narrowed down your search to a handful of
instructions, you can use gdb to do this. Just place a breakpoint on
each instruction you are interested in, and set a large "ignore" count
on the breakpoints. Then when the program is done, or a breakpoint
counts down to zero and triggers, you can use "info breakpoints" to
see how many times each breakpoint has been hit.
If you are looking for hotpoints in an entire program, you might want
to look into hacking an emulator to maintain a counter for every
instruction byte -- incrementing it every time the program counter
changes.
> So far I know two types of profiling tools: gprof and memory
> profiler (valgrind and friends); I don't know if what I mentioned
> is available or people have ever done it.
What exactly is it that you want to do with the tool that you cannot
do with gprof and gdb? Perhaps if you explained what you feel you
need it for, people could point you to a ready made solution to the
problem. If you are just looking for a project that has not been done
before (to our knowledge), then hacking an existing emulator to count
instruction usage, and perhaps even keeping track of pipeline stalls
caused by bad instruction order, is a project worth doing in my
opinion.