Thread: compiler skipping lines..?

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    71

    compiler skipping lines..?

    hi everyone,
    i just ran a little test program, but got no output from two cout lines (commented out below) - i traced through it, and saw them get skipped. why is that? (they're not commented out when i run it)

    Code:
    #include <string.h>
    #include <iostream.h>
    
    void main () {
    	char str[] = "	avg: real;	 {dgjhd;a comment}";
    //  	cout << str << "\nits length: " << strlen(str) << endl;
    	char *brokenstr;
    	cout << "remaining part of string: ";
    	brokenstr = strtok (str,"{");
    	cout << brokenstr;
    //	cout << "\nits length: " << strlen(brokenstr);  
    	return;
    }

  2. #2
    Registered User blight2c's Avatar
    Join Date
    Mar 2002
    Posts
    266
    did you run it with the // in there as i see it now, if so take them out

    [edit]
    next time i'll finish reading your post before i answer, i don't know lemme see . . .

  3. #3
    Something Clever ginoitalo's Avatar
    Join Date
    Dec 2001
    Posts
    187
    Prints Fine...

    Code:
    #include <string.h>
    #include <iostream.h>
    
    void main () {
    	char str[] = "	avg: real;	 {dgjhd;a comment}";
      	cout << str << "\nits length: " << strlen(str) << endl;
    	char *brokenstr;
    	cout << "remaining part of string: ";
    	brokenstr = strtok (str,"{");
    	cout << brokenstr;
    	cout << "\nits length: " << strlen(brokenstr);  
    	return;
    }

  4. #4
    Something Clever ginoitalo's Avatar
    Join Date
    Dec 2001
    Posts
    187
    Output :


    avg: real; {dgjhd;a comment}
    its length: 30
    remaining part of string: avg: real;
    its length: 13

  5. #5
    Registered User blight2c's Avatar
    Join Date
    Mar 2002
    Posts
    266
    dito

  6. #6
    Registered User
    Join Date
    Jan 2002
    Posts
    71
    thanks for saying what the output is

    my stupid weird compiler

  7. #7
    Something Clever ginoitalo's Avatar
    Join Date
    Dec 2001
    Posts
    187
    That Ran fine wherever I ran it,
    what compiler are your using anyways ?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Which Compiler?
    By Bladactania in forum C Programming
    Replies: 10
    Last Post: 02-11-2009, 01:32 AM
  2. [resolved] internal compiler error...
    By bling in forum C++ Programming
    Replies: 2
    Last Post: 12-10-2008, 12:57 PM
  3. how to call a compiler?
    By castlelight in forum C Programming
    Replies: 3
    Last Post: 11-22-2005, 11:28 AM
  4. skipping lines
    By LightKnight86 in forum C++ Programming
    Replies: 2
    Last Post: 09-20-2003, 08:26 PM
  5. Bad code or bad compiler?
    By musayume in forum C Programming
    Replies: 3
    Last Post: 10-22-2001, 09:08 PM