Salem 5,265 Posting Sage

@ allan2008
Shameless rip-off of http://webdesign.about.com/od/advancedcss/a/aa052200a.htm
I guess you're just recycling so you can spam your sig-links whilst making it look like you're adding useful content.

Salem 5,265 Posting Sage
install: /home/juan/Desktop/Codigos/IVR/ppal.agi
        mv /home/juan/Desktop/Codigos/IVR/ppal.agi /var/lib/asterisk/agi-bin

I was thinking along these lines

Salem 5,265 Posting Sage

You could create a rule called 'install', which copies from the build directory to the target directory.

Salem 5,265 Posting Sage

That is unfortunate....

But your description so far is about as useful as phoning up the doc's and saying "I've got a red patch of skin" and expecting an expert diagnosis.
http://www.catb.org/~esr/faqs/smart-questions.html

Show some commands you ACTUALLY tried.

Lightninghawk commented: :) +5
Salem 5,265 Posting Sage

Well?

$ xcopy /?
Copies files and directory trees.

NOTE: Xcopy is now deprecated, please use Robocopy.

XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/V] [/W]
                           [/C] [/I] [/Q] [/F] [/L] [/G] [/H] [/R] [/T] [/U]
                           [/K] [/N] [/O] [/X] [/Y] [/-Y] [/Z] [/B]
                           [/EXCLUDE:file1[+file2][+file3]...]

  source       Specifies the file(s) to copy.
  destination  Specifies the location and/or name of new files.
  /A           Copies only files with the archive attribute set,
               doesn't change the attribute.
  /M           Copies only files with the archive attribute set,
               turns off the archive attribute.
  /D:m-d-y     Copies files changed on or after the specified date.
               If no date is given, copies only those files whose
               source time is newer than the destination time.
  /EXCLUDE:file1[+file2][+file3]...
               Specifies a list of files containing strings.  Each string
               should be in a separate line in the files.  When any of the
               strings match any part of the absolute path of the file to be
               copied, that file will be excluded from being copied.  For
               example, specifying a string like \obj\ or .obj will exclude
               all files underneath the directory obj or all files with the
               .obj extension respectively.
  /P           Prompts you before creating each destination file.
  /S           Copies directories and subdirectories except empty ones.
  /E           Copies directories and subdirectories, including empty ones.
               Same as /S /E. May be used to modify /T.
  /V           Verifies the size of each new file.
  /W           Prompts you to press a key before copying.
  /C           Continues copying even if errors occur.
  /I           If destination does …
Salem 5,265 Posting Sage

If you've let the MBS escape, then it's almost certainly done for :(

Salem 5,265 Posting Sage

If you want to make any sense of OO documents, you first have to unzip them.

Example - just rename your foo.odt to foo.zip, then examine it with your ZIP program.
All the interesting stuff is stored as a series of XML files.

Salem 5,265 Posting Sage
Rajesh R Subram commented: Neat! +1
Salem 5,265 Posting Sage

What do you think?

Or ask yourself the question, if the answer were "No", what sort of chaos would result?

Salem 5,265 Posting Sage

While we're on the subject of "don't", don't call main recursively as a simple way of generating a loop.

Recursive calls to main() are illegal in C++.

Salem 5,265 Posting Sage

What are you going to use it for?
- high end game playing
- server farm
- s/w development
- surfing the web

What else are you intending to buy? To get the best out of it, you need to match it with similar spec memory, disks etc etc.

Salem 5,265 Posting Sage
Salem 5,265 Posting Sage

So why does
vector.c include vector.h
AND
vector.h include vector.c

tux4life commented: Super helpful, as usual :) +6
Salem 5,265 Posting Sage

Unless you can post an actual bit of code we can copy/paste into a compiler, then I'm afraid there isn't much to say.

The problem isn't in the bit you posted, it lies elsewhere.

Salem 5,265 Posting Sage

If you have a compiler already installed, and in your PATH environment variable, then just press F5 and type
gcc prog.c
where gcc is the name of your compiler, and prog.c is the current filename you're editing.

Then press F1 to figure out how to make the command automatically substitute the name of the current filename.

>dude i knw hw to speak/explain in english..
Lastly, drop the SMS chat speak.
http://www.catb.org/~esr/faqs/smart-questions.html#writewell

Salem 5,265 Posting Sage

Does vector.h include vector.h ?
Check for a missing ; either at the end of the .h file, or earlier on in the .c file.

Salem 5,265 Posting Sage

All the port numbers, and what they're used for.
http://www.iana.org/assignments/port-numbers

nezachem commented: Beaten! +1
Salem 5,265 Posting Sage

> while(scanf("%d %d", &row, &column) != EOF);
Guess what the ; at the end of this line does.

As in while(scanf("%d %d", &row, &column) != EOF) { /*nothing at all here */ }

Salem 5,265 Posting Sage

Lines 42 to 45 need { }

You should always use them, even in the places where they're considered optional. It takes almost no effort to add them (none at all for intelligent IDE's), but the amount of bug hunting they cause by omission can be huge.

Salem 5,265 Posting Sage

Or ditch dev-c++ as your IDE and go with something like code::blocks.
dev-c++ is no longer maintained, and is known to be somewhat buggy.

Salem 5,265 Posting Sage

Everything after the exec() does NOT get executed (unless there is an error). Your process gets replaced by the telnet process.

Any (and all) the communication with the child (telnet) process needs to be placed after
printf("Mother\n");

I would suggest you try a much simpler process to play with rather than telnet. A simple "echo" program perhaps, which reads stdin, and writes it back out to stdout.

Salem 5,265 Posting Sage

Yes, you are completely wrong.

fork() creates a copy of your program, but it's another process in a "parent-child" relationship. Use the return result to figure out which is which.

pid = fork();
if ( /*RTFM*/ ) {
  // in child, call exec() to run telnet
} else {
  // in parent, read/write to the ends of pipes to communicate
  // with telnet (the child process you just exec'ed above).
}

The rest of the calls are for creating the pipes and mapping stdin,stdout to the ends of those pipes.

Salem 5,265 Posting Sage

popen is a SIMPLE wrapper for uni-directional communication only (either reading or writing). Some enhanced versions of popen() allow bi-directional flow (which is what you would want for an interactive program like telnet).

If you want real control over what is going on, then you'll need to read up on these API calls
pipe()
dup() or dup2()
fork()
exec()
close()

Salem 5,265 Posting Sage

Anyone what?
If you stop talking about getch() and other non-standard functions, we might be able to explain what happens.

Salem 5,265 Posting Sage

Standard C doesn't allow you to declare variables in the middle of statement blocks.

jephthah commented: that's like almost psychic :icon_eek: +5
Salem 5,265 Posting Sage

Post your code!
Did you initialise i ?

yellowSnow commented: For utter utter patience! +7
Kombat commented: very very patient and helpful!! +1
tux4life commented: You're a patient man Salem. And the help you provide is excellent! +23
Salem 5,265 Posting Sage

result[numchars++] = basechars[r];

When you're done, print from numchars-1 back down to 0 (one char at a time).

Salem 5,265 Posting Sage

> basechars[r]
You're printing them, not storing them!

Salem 5,265 Posting Sage

Store each char in another array, then print it out backwards?

Salem 5,265 Posting Sage

Well it's good for bases < 10 char basechars[] = "0123456789"; and printf("%c", basechars[r] );

Salem 5,265 Posting Sage

> That is how I get the binary.
That's how you do it for every other base as well.

Salem 5,265 Posting Sage

pow (23, 2)
You're passing two integers.

> 'pow(int, int)' is ambiguous
two integers is confusing....

> double std::pow(double, int)
A variety of combinations involving floating point types is offered.

Pick one, and make an appropriate constant a float (of whatever type).

Salem 5,265 Posting Sage

File permissions are platform specific, so you only get access to them using platform specific APIs.

Salem 5,265 Posting Sage

Taking a stab at guessing line 98

VoltageGain = double pow ((275 / sqrt (pow (23, 2) + 0.5 * pow (f, 2))), n);

What does double do here?

Salem 5,265 Posting Sage

pipes are a POSIX API (and not a language issue at all).

If you've got an appropriate declaration, then you can call them from whatever language you like (perl and python can access pipes as well).

Salem 5,265 Posting Sage

Maybe we could start with which language you know, and how well you know it.

Learn C++
Learn Java
The "how to go from x to y" problem will then be self evident to you.

Salem 5,265 Posting Sage

So do it in stages, say the spaces up to and including the first hash.

You don't have to write the whole thing just to make progress.

Salem 5,265 Posting Sage

How would I know.
You've now got two programs, and you've posted the code for neither of them.

Salem 5,265 Posting Sage

if(! CreateProcess("C:\\WINDOWS\\system32\\cmd.exe",
This needs to be something like if(! CreateProcess("C:\\Users\\me\\Documents\\Projects\\Fib\\myfib.exe", It does all the work.

This code just has to create the process and wait for it to finish.

Salem 5,265 Posting Sage

Use %s to print a string of chars.

Salem 5,265 Posting Sage
int nrP = 6;
for ( i = 1 ; i < nrP ; i++ ) {
  cout << i << " " << (2 * nrP - 2 * i - 1) << endl;
}

Notice anything about the sequence of numbers?

Salem 5,265 Posting Sage

> if(fgets(temp, sizeof(temp), file) != NULL)
To read the whole file, do
while(fgets(temp, sizeof(temp), file) != NULL)

Oh, and remove the fclose() from inside the loop.

Or better yet, leave it there and learn something ;)

Salem 5,265 Posting Sage
Salem 5,265 Posting Sage

So use the debugger and put a breakpoint at the start of where you suspect the problem starts, and then wait for the first of the "first chance exceptions" to happen.

Then home in on the problem.

Salem 5,265 Posting Sage

Try intel.com then.

Salem 5,265 Posting Sage

Lessons in cause and effect.

Memory is allocated from one (or more) larger pools of memory.

int main ( ) {
    int *p = new int[10];
    for ( int i = 0 ; i <= 10 ; i++ ) p[i] = 0;  // overrun!!
    double *q = new double[1000];  // exception POSSIBLE here
    /// more code
    delete [ ] q; // exception POSSIBLE here
    delete [ ] p; // exception POSSIBLE here
    return 0;
}

Depending on how badly you screwed up, you may not even get to notice that there is a problem (the program behaves as expected, despite the bugs).

More likely, you make some totally unrelated change in another part of the system and that change immediately blows up in your face (you're confused now right?).

Say the exception happens on the green line of code, how do you get back to the red line of code where the real problem is?
Well, that's a tricky one.
http://msdn.microsoft.com/en-us/library/aa298452%28VS.60%29.aspx
Scattering a few _CrtCheckMemory( ); calls through the code, or setting the debug options to do this every 'n' calls would help narrow the gap between effect (where you notice) and cause (what you need to find and fix).

There are tools for windows (for $$$$$) which can help with this.
Shame really, the tools for this on Linux are available for $0.

> //error checking, saves your ****!
This made me laugh.
I lost count …

Salem 5,265 Posting Sage

http://www.daniweb.com/forums/thread222501.html
OK, I've replied to both your questions now :icon_wink:

Salem 5,265 Posting Sage

Doubtful - it won't compile with TurboCrap, and it wasn't posted with code tags.
Does anybody bother to read intro threads?

Salem 5,265 Posting Sage

You can't assign arrays.
Use strcpy() instead.

Salem 5,265 Posting Sage

http://www.codeblocks.org/
http://www.microsoft.com/express/
Both are FREE (except for the time taken to download)
Both WIPE THE FLOOR with the fossil you have.
Both will serve you well when you want to actually USE the OS you're running on.

Have you considered that your 20 year old fossil might not like
- filenames longer than 8 characters
- filenames with spaces
- filenames encoded in unicode
- filenames with characters which are not ASCII
- filenames which are not on a FAT16 file system
And that's just the beginning of all the pain and struggle which awaits.