Like Tree1Likes
  • 1 Post By claudiu

help

This is a discussion on help within the C Programming forums, part of the General Programming Boards category; i created a program use in c for simulate the printer spooler but i have a trouble ---> i want ...

  1. #1
    Registered User
    Join Date
    Mar 2012
    Posts
    3

    help

    i created a program use in c for simulate the printer spooler but i have a trouble ---> i want to print the file where located in current directory --->but any one know the method how i select the file in current directory
    ex
    -use in scanf i can read the user input and assign to the variable ,like that when user enter file name how i assign it for char variable ???
    scan user input and assign this file name into char variable because i want to include this file name into fifo queue because then i can print this file
    its consumer producer algorithm plz help me to solve this problem because i was new to c
    thanks......

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,452
    "help" is not a topic title.
    How To Ask Questions The Smart Way

    You wrote a producer/consumer, but can't use scanf() to read a string into an array?

    Post some code to show us what you've actually tried.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    This sounds like another : "I scavenged for some codez, youz makes it workz for me nowz!"
    rags_to_riches likes this.
    1. Get rid of gets(). Never ever ever use it again. Replace it with fgets() and use that instead.
    2. Get rid of void main and replace it with int main(void) and return 0 at the end of the function.
    3. Get rid of conio.h and other antiquated DOS crap headers.
    4. Don't cast the return value of malloc, even if you always always always make sure that stdlib.h is included.

  4. #4
    Registered User ssharish2005's Avatar
    Join Date
    Sep 2005
    Location
    Cambridge, UK
    Posts
    1,682
    lol I love the tone here. Yeah showz usz the codez...

    ssharish
    Life is like riding a bicycle. To keep your balance you must keep moving - Einstein

Popular pages Recent additions subscribe to a feed

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21