Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  • Users: Samohtvii
  • Content: Threads
  • Order by date
  1. Samohtvii

    gprolog read line.

    All my inputs only work if i put a full stop at the end of them. Is there anyway to make it so i can just input something and press enter. Also those inputs can only be one word so i can't make and spaces. Thanks for the help.
  2. Samohtvii

    Creating a file if does not exist

    I have my program reading in data from a file but i want it to create a file if the given filename does not exist. read(File), open(File, read, S), read(S, X), close(S), doStuff(X). I have found that in the open line I should be able to have | open(File, readwrite, S), but that doesn't work...
  3. Samohtvii

    formatted io.

    I am using swi-prolog and I can't get formatted io to work. I have been taught: fmt_read() and fmt_write() are those correct? Why isn't it working? Thanks
  4. Samohtvii

    PROLOG if statements

    Ok I haven't really found any clear way of doing an If statement in PROLOG. I want to read a word into a variable and then run either one of 2 functions if the answer is yes or no. Bare in mind I am very new to PROLOG so here is what I have: read(Var), yesVar :- Var="Yes", yesFunction(Var)...
  5. Samohtvii

    Can't run the simplest of programs. HELP

    I am simply trying to set-up my prolog environment and ii have a simply program. write(a). that's it... It always tells me "No permission to modify static procedure `write/1'" Also does the same for read. As i have never used prolog is it something wrong with how i have set it up or do i need...
  6. Samohtvii

    Line length in FORTRAN

    Is there a set length you of line you can put code on? Eventually if a line goes too long i get an error and it clearly just stops mid line and outputs a random error. It's really annoying when i want a line of text on one line so is there a way i can say print this on one line: print *, 'This...
  7. Samohtvii

    Avoid reading to new line

    If i have a text file say: "dog cat mouse elephant" and i want to read those into an char array the reader always just reads dog and then moves to a new line. I don't know how many 'animals' will be in the text file so i can't just read (7,*) animal(1), animal(2) etc, but i do know there isn't...
  8. Samohtvii

    Calling functions

    I thought calling a function seemed easy enough until i tried to write one. I though it was as easy as: program test testFunction() end program test FUNCTION testFunction() print *, "Hello World" END EDIT: ok so why does below work. I just want a function that makes my code cleaning. No...
  9. Samohtvii

    Writing whole strings including whitespace?

    Can someone tell me how to write whole lines to text files. Here is what I have tried but got just the first word 'do'. is has opened unit 7 as append for an existing file CHARACTER*50 newQuestion read *, newQuestion write(7, '(A)') newQuestion say i type "do you want to?" it only adds the 'do'...
  10. Samohtvii

    IF statements and comparing character strings

    I have tried everything to get a simple bit of code to work but nothing has worked. pseudocode: get user answer (yes/no) if answer = yes print yes I always get the same error "Cannot assign to a named constant" i have tried -- t = LGT(answer, 'yes') IF(t) -- if(answer .eq. 'yes) --...
  11. Samohtvii

    Reading lines of text from file

    Hi all just wondering how to get a line of text into a character string. What i have now gets the first word but I want the whole line character*50 data open (7, FILE = 'animals') read (7, *) data print *, data thanks

Part and Inventory Search

Back
Top